[vlc-devel] commit: Fix potential memleaks (CID 222 and 221) ( Rémi Duraffort )

git version control git at videolan.org
Wed Oct 1 21:45:40 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Oct  1 21:43:48 2008 +0200| [543a4d3b713725772dcf40edbf985d1761bed429] | committer: Rémi Duraffort 

Fix potential memleaks (CID 222 and 221)

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

 modules/video_filter/gradient.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/gradient.c b/modules/video_filter/gradient.c
index cb5e4d2..dc203af 100644
--- a/modules/video_filter/gradient.c
+++ b/modules/video_filter/gradient.c
@@ -635,16 +635,27 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
     double d_sin;
     double d_cos;
     uint32_t *p_smooth;
+
     int *p_hough = malloc( i_diag * i_nb_steps * sizeof(int) );
     if( ! p_hough ) return;
+
     p_smooth = (uint32_t *)malloc( i_num_lines*i_src_visible*sizeof(uint32_t));
-    if( !p_smooth ) return;
+    if( !p_smooth )
+    {
+        free( p_hough );
+        return;
+    }
 
     if( ! p_pre_hough )
     {
         msg_Dbg(p_filter, "Starting precalculation");
         p_pre_hough = malloc( i_num_lines*i_src_visible*i_nb_steps*sizeof(int));
-        if( ! p_pre_hough ) return;
+        if( ! p_pre_hough )
+        {
+            free( p_smooth );
+            free( p_hough );
+            return;
+        }
         for( i = 0 ; i < i_nb_steps ; i++)
         {
             d_sin = sin(d_step * i);




More information about the vlc-devel mailing list