From 011d60ec03ac278c5bb5de04e9a60a160dafc362 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 21 Jun 2016 17:04:22 +0100 Subject: [PATCH] Fixed memory leak. --- src/osg/glu/libutil/mipmap.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osg/glu/libutil/mipmap.cpp b/src/osg/glu/libutil/mipmap.cpp index 3720e8525..af66c39e6 100644 --- a/src/osg/glu/libutil/mipmap.cpp +++ b/src/osg/glu/libutil/mipmap.cpp @@ -4585,7 +4585,8 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); #endif - free(dstImage); + if (srcImage) free(srcImage); + if (dstImage) free(dstImage); return GLU_OUT_OF_MEMORY; }