From: RĂ©mi Duraffort Date: Tue, 19 May 2009 17:51:02 +0000 (+0200) Subject: Create a function to free the memory allocated when calling X-Git-Tag: 1.1.0-ff~5865 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=adf4fbbf6008c49512ed3313091112b8077cae05;p=vlc Create a function to free the memory allocated when calling var_Change(VLC_VAR_GETCHOICES). The memory was freed by a call to var_Change(VLC_VAR_FREELIST). That's not a good idea as we were doing a lookup just to free some memory. --- diff --git a/include/vlc_variables.h b/include/vlc_variables.h index a7ce058cfd..2261c82e29 100644 --- a/include/vlc_variables.h +++ b/include/vlc_variables.h @@ -109,8 +109,7 @@ #define VLC_VAR_GETCHOICES 0x0024 #define VLC_VAR_FREECHOICES 0x0025 #define VLC_VAR_GETLIST 0x0026 -#define VLC_VAR_FREELIST 0x0027 -#define VLC_VAR_CHOICESCOUNT 0x0028 +#define VLC_VAR_CHOICESCOUNT 0x0027 #define VLC_VAR_INHERITVALUE 0x0030 @@ -134,6 +133,8 @@ VLC_EXPORT( int, var_GetChecked, ( vlc_object_t *, const char *, int, vlc_value_ #define var_Command(a,b,c,d,e) __var_Command( VLC_OBJECT( a ), b, c, d, e ) VLC_EXPORT( int, __var_Command, ( vlc_object_t *, const char *, const char *, const char *, char ** ) ); +VLC_EXPORT( void, var_FreeList, ( vlc_value_t *, vlc_value_t * ) ); + /** * __var_Create() with automatic casting. */ diff --git a/modules/access/v4l2.c b/modules/access/v4l2.c index 27c139fe7d..705eb66c41 100644 --- a/modules/access/v4l2.c +++ b/modules/access/v4l2.c @@ -2920,7 +2920,7 @@ static void SetAvailControlsByString( vlc_object_t *p_obj, demux_sys_t *p_sys, psz_parser = ( *psz_delim ) ? ( psz_delim + 1 ) : psz_delim; } } - var_Change( p_obj, "allcontrols", VLC_VAR_FREELIST, &val, &text ); + var_FreeList( &val, &text ); } /***************************************************************************** diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c index 0604bea528..ee4757d1a6 100644 --- a/modules/control/hotkeys.c +++ b/modules/control/hotkeys.c @@ -541,7 +541,7 @@ static void Run( intf_thread_t *p_intf ) _("Aspect ratio: %s"), text_list.p_list->p_values[i].psz_string ); - var_Change( p_vout, "aspect-ratio", VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } free( val.psz_string ); } @@ -569,7 +569,7 @@ static void Run( intf_thread_t *p_intf ) _("Crop: %s"), text_list.p_list->p_values[i].psz_string ); - var_Change( p_vout, "crop", VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } free( val.psz_string ); } @@ -636,7 +636,7 @@ static void Run( intf_thread_t *p_intf ) _("Deinterlace mode: %s"), text_list.p_list->p_values[i].psz_string ); - var_Change( p_vout, "deinterlace", VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } free( val.psz_string ); } @@ -668,7 +668,7 @@ static void Run( intf_thread_t *p_intf ) _("Zoom mode: %s"), text_list.p_list->p_values[i].var.psz_name ); - var_Change( p_vout, "zoom", VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } } else if( i_action == ACTIONID_CROP_TOP && p_vout ) diff --git a/modules/control/http/mvar.c b/modules/control/http/mvar.c index c25dd34d29..2cef899c65 100644 --- a/modules/control/http/mvar.c +++ b/modules/control/http/mvar.c @@ -450,8 +450,7 @@ mvar_t *mvar_InputVarSetNew( intf_thread_t *p_intf, char *name, } /* clean up everything */ if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); - var_Change( p_sys->p_input, psz_variable, VLC_VAR_FREELIST, &val_list, - &text_list ); + var_FreeList( &val_list, &text_list ); return s; } diff --git a/modules/control/rc.c b/modules/control/rc.c index 1303d219af..cb8c23705a 100644 --- a/modules/control/rc.c +++ b/modules/control/rc.c @@ -1153,8 +1153,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, &val_list, NULL ); msg_rc( "Currently playing chapter %d/%d.", val.i_int, val_list.p_list->i_count ); - var_Change( p_this, "chapter", VLC_VAR_FREELIST, - &val_list, NULL ); + var_FreeList( &val_list, NULL ); } } else if( !strcmp( psz_cmd, "chapter_n" ) ) @@ -1186,8 +1185,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, &val_list, NULL ); msg_rc( "Currently playing title %d/%d.", val.i_int, val_list.p_list->i_count ); - var_Change( p_this, "title", VLC_VAR_FREELIST, - &val_list, NULL ); + var_FreeList( &val_list, NULL ); } } else if( !strcmp( psz_cmd, "title_n" ) ) @@ -1262,8 +1260,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd, msg_rc( "| %i - %s", val.p_list->p_values[i].i_int, text.p_list->p_values[i].psz_string ); } - var_Change( p_input, psz_variable, VLC_VAR_FREELIST, - &val, &text ); + var_FreeList( &val, &text ); msg_rc( "+----[ end of %s ]", val_name.psz_string ); free( val_name.psz_string ); @@ -1792,8 +1789,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd, } free( psz_value ); } - var_Change( p_vout, psz_variable, VLC_VAR_FREELIST, - &val, &text ); + var_FreeList( &val, &text ); msg_rc( "+----[ end of %s ]", val_name.psz_string ); free( val_name.psz_string ); @@ -1880,8 +1876,7 @@ static int AudioConfig( vlc_object_t *p_this, char const *psz_cmd, msg_rc( "| %i - %s", val.p_list->p_values[i].i_int, text.p_list->p_values[i].psz_string ); } - var_Change( (vlc_object_t *)p_aout, psz_variable, VLC_VAR_FREELIST, - &val, &text ); + var_FreeList( &val, &text ); msg_rc( "+----[ end of %s ]", val_name.psz_string ); free( val_name.psz_string ); diff --git a/modules/demux/ts.c b/modules/demux/ts.c index 180507ad5d..a2b4ef3b01 100644 --- a/modules/demux/ts.c +++ b/modules/demux/ts.c @@ -843,7 +843,7 @@ static void Close( vlc_object_t *p_this ) { vlc_value_t val; val.p_list = p_sys->p_programs_list; - var_Change( p_demux, "programs", VLC_VAR_FREELIST, &val, NULL ); + var_FreeList( &val, NULL ); } /* If in dump mode, then close the file */ diff --git a/modules/gui/beos/InterfaceWindow.cpp b/modules/gui/beos/InterfaceWindow.cpp index 12220de4dd..ec92a03fe7 100644 --- a/modules/gui/beos/InterfaceWindow.cpp +++ b/modules/gui/beos/InterfaceWindow.cpp @@ -671,13 +671,11 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) &val_list, NULL ); if( val_list.p_list->i_count > val.i_int ) { - var_Change( p_input, "chapter", VLC_VAR_FREELIST, - &val_list, NULL ); + var_FreeList( &val_list, NULL ); var_SetVoid( p_input, "next-chapter" ); break; } - var_Change( p_input, "chapter", VLC_VAR_FREELIST, - &val_list, NULL ); + var_FreeList( &val_list, NULL ); } /* Try to go to next title */ @@ -687,13 +685,11 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) &val_list, NULL ); if( val_list.p_list->i_count > val.i_int ) { - var_Change( p_input, "title", VLC_VAR_FREELIST, - &val_list, NULL ); + var_FreeList( &val_list, NULL ); var_SetVoid( p_input, "next-title" ); break; } - var_Change( p_input, "title", VLC_VAR_FREELIST, - &val_list, NULL ); + var_FreeList( &val_list, NULL ); } /* Try to go to next file */ @@ -1264,7 +1260,7 @@ void LanguageMenu::AttachedToWindow() } AddItem( item ); } - var_Change( p_input, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); vlc_object_release( p_input ); @@ -1327,8 +1323,7 @@ void TitleMenu::AttachedToWindow() AddItem( item ); } - var_Change( p_input, "title", VLC_VAR_FREELIST, - &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } vlc_object_release( p_input ); BMenu::AttachedToWindow(); @@ -1391,8 +1386,7 @@ void ChapterMenu::AttachedToWindow() AddItem( item ); } - var_Change( p_input, "chapter", VLC_VAR_FREELIST, - &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } vlc_object_release( p_input ); BMenu::AttachedToWindow(); diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index 084c7f1f4c..88a6b004ab 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -861,7 +861,7 @@ /* clean up everything */ if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); - var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); } - (IBAction)toggleVar:(id)sender diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c index d2f8ec8d7f..ece460221f 100644 --- a/modules/gui/ncurses.c +++ b/modules/gui/ncurses.c @@ -1559,7 +1559,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh ) { mvnprintw( y++, 0, COLS, _(" Title : %d/%d"), val.i_int, val_list.p_list->i_count ); } - var_Change( p_input, "title", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); } /* Chapter */ @@ -1570,7 +1570,7 @@ static void Redraw( intf_thread_t *p_intf, time_t *t_last_refresh ) { mvnprintw( y++, 0, COLS, _(" Chapter : %d/%d"), val.i_int, val_list.p_list->i_count ); } - var_Change( p_input, "chapter", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); } } else diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp index 464c27ff8d..c2d516e7ed 100644 --- a/modules/gui/qt4/components/extended_panels.cpp +++ b/modules/gui/qt4/components/extended_panels.cpp @@ -692,8 +692,7 @@ void ExtV4l2::Refresh( void ) if( i_val == val2.p_list->p_values[j].i_int ) combobox->setCurrentIndex( j ); } - var_Change( p_obj, psz_var, VLC_VAR_FREELIST, - &val2, &text2 ); + var_FreeList( &val2, &text2 ); CONNECT( combobox, currentIndexChanged( int ), this, ValueChange( int ) ); @@ -758,7 +757,7 @@ void ExtV4l2::Refresh( void ) } free( name.psz_string ); } - var_Change( p_obj, "controls", VLC_VAR_FREELIST, &val, &text ); + var_FreeList( &val, &text ); vlc_object_release( p_obj ); } else diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index fd2381a4b9..82bdb04729 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -692,7 +692,7 @@ void InputManager::sectionMenu() if( !strcmp( text.p_list->p_values[i].psz_string, "Title" ) ) root = i; } - var_Change( p_input, "title 0", VLC_VAR_FREELIST, &val, &text ); + var_FreeList( &val, &text ); var_SetInteger( p_input, "title 0", root ); } @@ -760,7 +760,7 @@ void InputManager::activateTeletext( bool b_enable ) i = 0; var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[i].i_int : -1 ); } - var_Change( p_input, "teletext-es", VLC_VAR_FREELIST, &list, &text ); + var_FreeList( &list, &text ); } } diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 0a12c20bd6..387f5b8e9d 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -1129,7 +1129,7 @@ static bool IsMenuEmpty( const char *psz_var, } /* clean up everything */ - var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); return i_result; } @@ -1344,7 +1344,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var, currentGroup = NULL; /* clean up everything */ - var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); #undef CURVAL #undef CURTEXT diff --git a/modules/gui/wince/menus.cpp b/modules/gui/wince/menus.cpp index 3cebdc7cb5..2c3326b104 100644 --- a/modules/gui/wince/menus.cpp +++ b/modules/gui/wince/menus.cpp @@ -688,7 +688,7 @@ HMENU CreateChoicesMenu( intf_thread_t *p_intf, /* Clean up everything */ if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string ); - var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list ); + var_FreeList( &val_list, &text_list ); return hSubMenu; } diff --git a/modules/misc/lua/libs/variables.c b/modules/misc/lua/libs/variables.c index 16833bc6c4..15e8649133 100644 --- a/modules/misc/lua/libs/variables.c +++ b/modules/misc/lua/libs/variables.c @@ -200,7 +200,7 @@ static int vlclua_var_get_list( lua_State *L ) if( i_ret < 0 ) return vlclua_push_ret( L, i_ret ); vlclua_pushvalue( L, VLC_VAR_LIST, val ); vlclua_pushvalue( L, VLC_VAR_LIST, text ); - var_Change( *pp_obj, psz_var, VLC_VAR_FREELIST, &val, &text ); + var_FreeList( &val, &text ); return 2; } diff --git a/modules/misc/testsuite/test4.c b/modules/misc/testsuite/test4.c index a7280a5f28..84b393f3a9 100644 --- a/modules/misc/testsuite/test4.c +++ b/modules/misc/testsuite/test4.c @@ -123,7 +123,7 @@ static int Foo( vlc_object_t *p_this, char const *psz_cmd, { printf( "value %i: %s\n", i, val.p_list->p_values[i].psz_string ); } - var_Change( p_this, "honk", VLC_VAR_FREELIST, &val, NULL ); + var_FreeList( &val, NULL ); var_Destroy( p_this, "honk" ); diff --git a/src/control/audio.c b/src/control/audio.c index e33c264c74..5ef62c27a5 100644 --- a/src/control/audio.c +++ b/src/control/audio.c @@ -380,7 +380,7 @@ int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi, var_Change( p_input_thread, "audio-es", VLC_VAR_GETCHOICES, &val_list, NULL ); i_track_count = val_list.p_list->i_count; - var_Change( p_input_thread, "audio-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_track_count; @@ -429,7 +429,7 @@ int libvlc_audio_get_track( libvlc_media_player_t *p_mi, break; } } - var_Change( p_input_thread, "audio-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_track; } @@ -461,7 +461,7 @@ void libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track, libvlc_exception_raise( p_e, "Setting audio track failed" ); end: - var_Change( p_input_thread, "audio-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); } diff --git a/src/control/media_player.c b/src/control/media_player.c index 389fce92aa..126eef9cdb 100644 --- a/src/control/media_player.c +++ b/src/control/media_player.c @@ -1177,7 +1177,7 @@ libvlc_track_description_t * if( val_list.p_list->i_count <= 0 ) /* no tracks */ { - var_Change( p_input, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list); + var_FreeList( &val_list, &text_list); return NULL; } @@ -1186,8 +1186,7 @@ libvlc_track_description_t * malloc( sizeof( libvlc_track_description_t ) ); if ( !p_track_description ) { - var_Change( p_input, psz_variable, VLC_VAR_FREELIST, - &val_list, &text_list); + var_FreeList( &val_list, &text_list); vlc_object_release( p_input ); libvlc_exception_raise( p_e, "no enough memory" ); return NULL; @@ -1203,8 +1202,7 @@ libvlc_track_description_t * if ( !p_actual ) { libvlc_track_description_release( p_track_description ); - var_Change( p_input, psz_variable, VLC_VAR_FREELIST, - &val_list, &text_list); + var_FreeList( &val_list, &text_list); vlc_object_release( p_input ); libvlc_exception_raise( p_e, "no enough memory" ); return NULL; @@ -1218,7 +1216,7 @@ libvlc_track_description_t * p_previous = p_actual; p_actual = NULL; } - var_Change( p_input, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list); + var_FreeList( &val_list, &text_list); vlc_object_release( p_input ); return p_track_description; diff --git a/src/control/video.c b/src/control/video.c index f43a81556d..bece0e423b 100644 --- a/src/control/video.c +++ b/src/control/video.c @@ -272,7 +272,7 @@ int libvlc_video_get_spu( libvlc_media_player_t *p_mi, break; } } - var_Change( p_input_thread, "spu-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_spu; } @@ -289,7 +289,7 @@ int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi, var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL ); i_spu_count = val_list.p_list->i_count; - var_Change( p_input_thread, "spu-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_spu_count; @@ -334,7 +334,7 @@ void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu, } end: - var_Change( p_input_thread, "spu-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); } @@ -496,7 +496,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi, if( list.p_list->i_count > 0 ) var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int ); - var_Change( p_input_thread, "teletext-es", VLC_VAR_FREELIST, &list, NULL ); + var_FreeList( &list, NULL ); } } vlc_object_release( p_input_thread ); @@ -514,7 +514,7 @@ int libvlc_video_get_track_count( libvlc_media_player_t *p_mi, var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL ); i_track_count = val_list.p_list->i_count; - var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_track_count; @@ -557,7 +557,7 @@ int libvlc_video_get_track( libvlc_media_player_t *p_mi, break; } } - var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); return i_track; } @@ -588,6 +588,6 @@ void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track, libvlc_exception_raise( p_e, "Video track out of range" ); end: - var_Change( p_input_thread, "video-es", VLC_VAR_FREELIST, &val_list, NULL ); + var_FreeList( &val_list, NULL ); vlc_object_release( p_input_thread ); } diff --git a/src/input/es_out.c b/src/input/es_out.c index a0b0b1cad5..655e6043b4 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -1689,7 +1689,7 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, bool b_force ) break; } } - var_Change( p_sys->p_input, "programs", VLC_VAR_FREELIST, &val, NULL ); + var_FreeList( &val, NULL ); } else if( p_sys->i_mode == ES_OUT_MODE_AUTO ) { diff --git a/src/input/input.c b/src/input/input.c index 119b41c730..c40b9f0f30 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -1123,7 +1123,7 @@ static void InitPrograms( input_thread_t * p_input ) } else { - var_Change( p_input, "programs", VLC_VAR_FREELIST, &val, NULL ); + var_FreeList( &val, NULL ); } } } @@ -1138,7 +1138,7 @@ static void InitPrograms( input_thread_t * p_input ) { demux_Control( p_input->p->input.p_demux, DEMUX_SET_GROUP, -1, val.p_list ); - var_Change( p_input, "programs", VLC_VAR_FREELIST, &val, NULL ); + var_FreeList( &val, NULL ); } else { @@ -3228,7 +3228,7 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for es_out_Control( p_input->p->p_es_out_display, ES_OUT_SET_ES_DEFAULT_BY_ID, i_id ); es_out_Control( p_input->p->p_es_out_display, ES_OUT_SET_ES_BY_ID, i_id ); } - var_Change( p_input, "spu-es", VLC_VAR_FREELIST, &list, NULL ); + var_FreeList( &list, NULL ); } } diff --git a/src/libvlccore.sym b/src/libvlccore.sym index fc42f05cc5..3f1df055f8 100644 --- a/src/libvlccore.sym +++ b/src/libvlccore.sym @@ -416,6 +416,7 @@ __var_Command __var_Create __var_DelCallback __var_Destroy +var_FreeList __var_Get var_GetChecked __var_Set diff --git a/src/misc/variables.c b/src/misc/variables.c index 52a7f7e589..313f7000a2 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -605,20 +605,6 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name, } } break; - case VLC_VAR_FREELIST: - FreeList( p_val ); - if( p_val2 && p_val2->p_list ) - { - for( i = 0; i < p_val2->p_list->i_count; i++ ) - free( p_val2->p_list->p_values[i].psz_string ); - if( p_val2->p_list->i_count ) - { - free( p_val2->p_list->p_values ); - free( p_val2->p_list->pi_types ); - } - free( p_val2->p_list ); - } - break; case VLC_VAR_SETTEXT: free( p_var->psz_text ); if( p_val && p_val->psz_string ) @@ -1535,3 +1521,25 @@ int __var_Command( vlc_object_t *p_this, const char *psz_name, return i_ret; } + + +/** + * Free a list and the associated strings + * @param p_val: the list variable + * @param p_val2: the variable associated or NULL + */ +void var_FreeList( vlc_value_t *p_val, vlc_value_t *p_val2 ) +{ + FreeList( p_val ); + if( p_val2 && p_val2->p_list ) + { + for( int i = 0; i < p_val2->p_list->i_count; i++ ) + free( p_val2->p_list->p_values[i].psz_string ); + if( p_val2->p_list->i_count ) + { + free( p_val2->p_list->p_values ); + free( p_val2->p_list->pi_types ); + } + free( p_val2->p_list ); + } +}