projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
84de167
)
progs/util: Fix memory leak if LoadRGBImage fails.
author
Vinson Lee
<vlee@vmware.com>
Tue, 17 Nov 2009 18:11:50 +0000
(10:11 -0800)
committer
Vinson Lee
<vlee@vmware.com>
Fri, 4 Dec 2009 00:24:03 +0000
(16:24 -0800)
(cherry picked from commit
041cd0e110d41b543a0fe9cc484ae8373642912b
)
progs/util/readtex.c
patch
|
blob
|
history
diff --git
a/progs/util/readtex.c
b/progs/util/readtex.c
index 4e22bed81af4313ad1ab3221acbff7ef2ccf4874..ec27e20d6818d437b984423950a3ae9ab7c67eee 100644
(file)
--- a/
progs/util/readtex.c
+++ b/
progs/util/readtex.c
@@
-357,6
+357,7
@@
GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
fprintf(stderr,
"Error in LoadRGBImage %d-component images not implemented\n",
image->components );
+ FreeImage(image);
return NULL;
}
@@
-365,8
+366,10
@@
GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
bytes = image->sizeX * image->sizeY * image->components;
buffer = (GLubyte *) malloc(bytes);
- if (!buffer)
+ if (!buffer) {
+ FreeImage(image);
return NULL;
+ }
memcpy( (void *) buffer, (void *) image->data, bytes );