summaryrefslogtreecommitdiff
path: root/src/glu/sgi
diff options
context:
space:
mode:
Diffstat (limited to 'src/glu/sgi')
-rw-r--r--src/glu/sgi/libtess/mesh.c7
-rw-r--r--src/glu/sgi/libutil/mipmap.c5
2 files changed, 11 insertions, 1 deletions
diff --git a/src/glu/sgi/libtess/mesh.c b/src/glu/sgi/libtess/mesh.c
index ae861f8642..95f87cdc94 100644
--- a/src/glu/sgi/libtess/mesh.c
+++ b/src/glu/sgi/libtess/mesh.c
@@ -284,7 +284,12 @@ GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh )
}
e = MakeEdge( &mesh->eHead );
- if (e == NULL) return NULL;
+ if (e == NULL) {
+ memFree(newVertex1);
+ memFree(newVertex2);
+ memFree(newFace);
+ return NULL;
+ }
MakeVertex( newVertex1, e, &mesh->vHead );
MakeVertex( newVertex2, e->Sym, &mesh->vHead );
diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c
index af647af73c..c5faebd6a3 100644
--- a/src/glu/sgi/libutil/mipmap.c
+++ b/src/glu/sgi/libutil/mipmap.c
@@ -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;
}
@@ -3760,6 +3762,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels);
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
+ free(newImage);
return GLU_OUT_OF_MEMORY;
}
}
@@ -7382,6 +7385,8 @@ int gluScaleImage3D(GLenum format,
afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format,
GL_UNSIGNED_SHORT));
if (beforeImage == NULL || afterImage == NULL) {
+ free(beforeImage);
+ free(afterImage);
return GLU_OUT_OF_MEMORY;
}
retrieveStoreModes3D(&psm);