Fix memleak (the memory allocated by var_Control(VLC_VAR_GETCHOICES) must be
authorRémi Duraffort <ivoire@videolan.org>
Wed, 20 May 2009 08:32:22 +0000 (10:32 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 20 May 2009 08:32:22 +0000 (10:32 +0200)
deallocated).

src/control/audio.c

index e1575ce..e7a912f 100644 (file)
@@ -391,13 +391,17 @@ int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi,
 {
     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
     vlc_value_t val_list;
+    int i_track_count;
 
     if( !p_input_thread )
         return -1;
 
     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 );
+
     vlc_object_release( p_input_thread );
-    return val_list.p_list->i_count;
+    return i_track_count;
 }
 
 /*****************************************************************************