glu/sgi: Fix memory leak in gluScaleImage.
authorVinson Lee <vlee@vmware.com>
Sun, 22 Nov 2009 06:57:35 +0000 (01:57 -0500)
committerVinson Lee <vlee@vmware.com>
Fri, 4 Dec 2009 08:09:22 +0000 (00:09 -0800)
(cherry picked from commit a9c540f5dedbf593f8038fdbc95eecb60826ab26)

src/glu/sgi/libutil/mipmap.c

index af647af73c98cbc1bda3e61835a01a82142050a1..4139c304a1dfaf11d21a12340d49c9b99b5284c2 100644 (file)
@@ -3526,6 +3526,8 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin,
     afterImage =
        malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT));
     if (beforeImage == NULL || afterImage == NULL) {
+       free(beforeImage);
+       free(afterImage);
        return GLU_OUT_OF_MEMORY;
     }