[vlc-devel] commit: Fix memleak (the memory allocated by var_Control(VLC_VAR_GETCHOICES ) must be ( Rémi Duraffort )

git version control git at videolan.org
Wed May 20 18:53:58 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed May 20 10:32:22 2009 +0200| [25070505add5986cc392ebdd826240fd62929b59] | committer: Rémi Duraffort 

Fix memleak (the memory allocated by var_Control(VLC_VAR_GETCHOICES) must be
deallocated).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=25070505add5986cc392ebdd826240fd62929b59
---

 src/control/audio.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/control/audio.c b/src/control/audio.c
index e1575ce..e7a912f 100644
--- a/src/control/audio.c
+++ b/src/control/audio.c
@@ -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;
 }
 
 /*****************************************************************************




More information about the vlc-devel mailing list