From 543a4d3b713725772dcf40edbf985d1761bed429 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Wed, 1 Oct 2008 21:43:48 +0200 Subject: [PATCH] Fix potential memleaks (CID 222 and 221) --- modules/video_filter/gradient.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/video_filter/gradient.c b/modules/video_filter/gradient.c index cb5e4d22b4..dc203afe24 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); -- 2.39.5