[vlc-commits] audiobargraph: fix memory leak.

Rémi Duraffort git at videolan.org
Thu Aug 30 22:03:02 CEST 2012


vlc/vlc-2.0 | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Aug 29 20:10:25 2012 +0200| [be0e5b9bdb88bca67dae52f8b3afc27c4f67fee5] | committer: Jean-Baptiste Kempf

audiobargraph: fix memory leak.
(cherry picked from commit 6633ef04bdbcd73524b920a01f4dbe758f289e08)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_filter/audiobargraph_v.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/video_filter/audiobargraph_v.c b/modules/video_filter/audiobargraph_v.c
index d163503..c938b36 100644
--- a/modules/video_filter/audiobargraph_v.c
+++ b/modules/video_filter/audiobargraph_v.c
@@ -461,7 +461,6 @@ static int BarGraphCallback( vlc_object_t *p_this, char const *psz_var,
     VLC_UNUSED(oldval);
     filter_sys_t *p_sys = (filter_sys_t *)p_data;
     BarGraph_t *p_BarGraph = &(p_sys->p_BarGraph);
-    char* i_values;
     char* res = NULL;
 
     vlc_mutex_lock( &p_sys->lock );
@@ -488,15 +487,16 @@ static int BarGraphCallback( vlc_object_t *p_this, char const *psz_var,
             picture_Release( p_BarGraph->p_pic );
             p_BarGraph->p_pic = NULL;
         }
-        i_values = strdup( newval.psz_string );
+        char *psz_i_values = strdup( newval.psz_string );
         free(p_BarGraph->i_values);
         //p_BarGraph->i_values = NULL;
         //p_BarGraph->nbChannels = 0;
         // in case many answer are received at the same time, only keep one
-        res = strchr(i_values, '@');
+        res = strchr(psz_i_values, '@');
         if (res)
             *res = 0;
-        parse_i_values( p_BarGraph, i_values);
+        parse_i_values( p_BarGraph, psz_i_values);
+        free( psz_i_values );
         LoadBarGraph(p_this,p_BarGraph);
     }
     else if ( !strcmp( psz_var, "audiobargraph_v-alarm" ) )



More information about the vlc-commits mailing list