glu: Fix memory leak in __gl_meshMakeEdge.
authorVinson Lee <vlee@vmware.com>
Sun, 22 Nov 2009 06:45:53 +0000 (01:45 -0500)
committerVinson Lee <vlee@vmware.com>
Sun, 22 Nov 2009 06:45:53 +0000 (01:45 -0500)
src/glu/sgi/libtess/mesh.c

index ae861f864288d350d11283386bb89e244ab791e5..95f87cdc9499dd118d80986137a9ddfcc46fe7b1 100644 (file)
@@ -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 );