From: Vinson Lee Date: Wed, 17 Feb 2010 09:57:14 +0000 (-0800) Subject: progs/redbook: Fix memory leaks on error paths. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7eaf33ad0349e39dd6611b0b27aa44687e8c3014;p=mesa.git progs/redbook: Fix memory leaks on error paths. --- diff --git a/progs/redbook/convolution.c b/progs/redbook/convolution.c index 0543379f241..0898ef25e10 100644 --- a/progs/redbook/convolution.c +++ b/progs/redbook/convolution.c @@ -97,6 +97,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) pixels = (GLubyte *) malloc( n * sizeof( GLubyte )); if ( !pixels ) { fprintf( stderr, "Unable to malloc() bytes for pixels\n" ); + fclose( infile ); return NULL; } diff --git a/progs/redbook/histogram.c b/progs/redbook/histogram.c index de1e59edea6..70a52825772 100644 --- a/progs/redbook/histogram.c +++ b/progs/redbook/histogram.c @@ -102,6 +102,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) pixels = (GLubyte *) malloc( n * sizeof( GLubyte )); if ( !pixels ) { fprintf( stderr, "Unable to malloc() bytes for pixels\n" ); + fclose( infile ); return NULL; } diff --git a/progs/redbook/minmax.c b/progs/redbook/minmax.c index da5b875a475..8281800ba43 100644 --- a/progs/redbook/minmax.c +++ b/progs/redbook/minmax.c @@ -97,6 +97,7 @@ readImage( const char* filename, GLsizei* width, GLsizei *height ) pixels = (GLubyte *) malloc( n * sizeof( GLubyte )); if ( !pixels ) { fprintf( stderr, "Unable to malloc() bytes for pixels\n" ); + fclose( infile ); return NULL; }