- don't leak resources, CID 609+610 run 2

svn path=/trunk/; revision=37506
This commit is contained in:
Kamil Hornicek 2008-11-21 10:31:18 +00:00
parent 5bd9816a8a
commit 3abe5dfccd

View file

@ -3483,9 +3483,14 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin,
} }
beforeImage = beforeImage =
malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT)); malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT));
if (beforeImage == NULL) {
return GLU_OUT_OF_MEMORY;
}
afterImage = afterImage =
malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT)); malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) { if (afterImage == NULL) {
free(beforeImage);
return GLU_OUT_OF_MEMORY; return GLU_OUT_OF_MEMORY;
} }
@ -7339,9 +7344,14 @@ int gluScaleImage3D(GLenum format,
beforeImage = malloc(imageSize3D(widthIn, heightIn, depthIn, format, beforeImage = malloc(imageSize3D(widthIn, heightIn, depthIn, format,
GL_UNSIGNED_SHORT)); GL_UNSIGNED_SHORT));
if (beforeImage == NULL) {
return GLU_OUT_OF_MEMORY;
}
afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format, afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format,
GL_UNSIGNED_SHORT)); GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) { if (afterImage == NULL) {
free(beforeImage);
return GLU_OUT_OF_MEMORY; return GLU_OUT_OF_MEMORY;
} }
retrieveStoreModes3D(&psm); retrieveStoreModes3D(&psm);