[vlc-devel] commit: gestures: fix memleak with var_Change(VLC_VAR_GETCHOICES). ( Rémi Duraffort )

git version control git at videolan.org
Tue May 26 13:28:25 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue May 26 12:40:24 2009 +0200| [46a33c34dcc8536ab6c875731ce7338e7b59826a] | committer: Rémi Duraffort 

gestures: fix memleak with var_Change(VLC_VAR_GETCHOICES).

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

 modules/control/gestures.c |   40 ++++++++++++++++++++++++----------------
 1 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index ba41860..5c11790 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -306,8 +306,8 @@ static void RunIntf( intf_thread_t *p_intf )
 
             case GESTURE(UP,RIGHT,NONE,NONE):
                 {
-                   vlc_value_t val, list, list2;
-                   int i_count, i;
+                    vlc_value_t val, list, list2;
+                    int i_count, i;
 
                     p_playlist = pl_Hold( p_intf );
                     p_input = playlist_CurrentInput( p_playlist );
@@ -316,20 +316,22 @@ static void RunIntf( intf_thread_t *p_intf )
                     if( !p_input )
                         break;
 
-                   var_Get( p_input, "audio-es", &val );
-                   var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
-                               &list, &list2 );
-                   i_count = list.p_list->i_count;
-                   if( i_count <= 1 )
-                   {
-                       vlc_object_release( p_input );
-                       break;
-                   }
-                   for( i = 0; i < i_count; i++ )
-                   {
-                       if( val.i_int == list.p_list->p_values[i].i_int )
-                           break;
-                   }
+                    var_Get( p_input, "audio-es", &val );
+                    var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
+                                &list, &list2 );
+                    i_count = list.p_list->i_count;
+                    if( i_count <= 1 )
+                    {
+                        var_Change( p_input, "audio-es", VLC_VAR_FREELIST, &list,
+                                    &list2 );
+                        vlc_object_release( p_input );
+                        break;
+                    }
+                    for( i = 0; i < i_count; i++ )
+                    {
+                        if( val.i_int == list.p_list->p_values[i].i_int )
+                            break;
+                    }
                     /* value of audio-es was not in choices list */
                     if( i == i_count )
                     {
@@ -342,6 +344,8 @@ static void RunIntf( intf_thread_t *p_intf )
                     else
                         i++;
                     var_Set( p_input, "audio-es", list.p_list->p_values[i] );
+                    var_Change( p_input, "audio-es", VLC_VAR_FREELIST, &list,
+                                &list2 );
                     vlc_object_release( p_input );
                 }
                 break;
@@ -365,6 +369,8 @@ static void RunIntf( intf_thread_t *p_intf )
                     if( i_count <= 1 )
                     {
                         vlc_object_release( p_input );
+                        var_Change( p_input, "spu-es", VLC_VAR_FREELIST,
+                                    &list, &list2 );
                         break;
                     }
                     for( i = 0; i < i_count; i++ )
@@ -386,6 +392,8 @@ static void RunIntf( intf_thread_t *p_intf )
                     else
                         i++;
                     var_Set( p_input, "spu-es", list.p_list->p_values[i] );
+                    var_Change( p_input, "spu-es", VLC_VAR_FREELIST,
+                                &list, &list2 );
                     vlc_object_release( p_input );
                 }
                 break;




More information about the vlc-devel mailing list