progs/redbook: Fix memory leaks on error paths.
This commit is contained in:
parent
41b19c279a
commit
7eaf33ad03
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue