[vlc-devel] commit: Fix potential memleaks (CID 222 and 221) ( Rémi Duraffort )
git version control
git at videolan.org
Thu Oct 2 21:13:36 CEST 2008
vlc | branch: 0.9-bugfix | Rémi Duraffort <ivoire at videolan.org> | Wed Oct 1 21:43:48 2008 +0200| [69956f28e7d7982b4b3b4838adecfbdc22b7acd0] | committer: Derk-Jan Hartman
Fix potential memleaks (CID 222 and 221)
(cherry picked from commit 543a4d3b713725772dcf40edbf985d1761bed429)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=69956f28e7d7982b4b3b4838adecfbdc22b7acd0
---
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 f1c57cd..fcfd058 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