Author: khornicek
Date: Fri Nov 21 04:31:18 2008
New Revision: 37506
URL:
http://svn.reactos.org/svn/reactos?rev=37506&view=rev
Log:
- don't leak resources, CID 609+610 run 2
Modified:
trunk/reactos/dll/win32/glu32/libutil/mipmap.c
Modified: trunk/reactos/dll/win32/glu32/libutil/mipmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/glu32/libutil/mi…
==============================================================================
--- trunk/reactos/dll/win32/glu32/libutil/mipmap.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/glu32/libutil/mipmap.c [iso-8859-1] Fri Nov 21 04:31:18 2008
@@ -3483,10 +3483,15 @@
}
beforeImage =
malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT));
+ if (beforeImage == NULL) {
+ return GLU_OUT_OF_MEMORY;
+ }
+
afterImage =
malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT));
- if (beforeImage == NULL || afterImage == NULL) {
- return GLU_OUT_OF_MEMORY;
+ if (afterImage == NULL) {
+ free(beforeImage);
+ return GLU_OUT_OF_MEMORY;
}
retrieveStoreModes(&psm);
@@ -7339,9 +7344,14 @@
beforeImage = malloc(imageSize3D(widthIn, heightIn, depthIn, format,
GL_UNSIGNED_SHORT));
+ if (beforeImage == NULL) {
+ return GLU_OUT_OF_MEMORY;
+ }
+
afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format,
GL_UNSIGNED_SHORT));
- if (beforeImage == NULL || afterImage == NULL) {
+ if (afterImage == NULL) {
+ free(beforeImage);
return GLU_OUT_OF_MEMORY;
}
retrieveStoreModes3D(&psm);