dri: Rework planar image interface
[mesa.git] / src / glu / sgi / libtess / mesh.c
index ae861f864288d350d11283386bb89e244ab791e5..36cb3a7be29aa637fa0adc4a6c69d9575b6a8a43 100644 (file)
 #include "mesh.h"
 #include "memalloc.h"
 
+#ifndef TRUE
 #define TRUE 1
+#endif
+#ifndef FALSE
 #define FALSE 0
+#endif
 
 static GLUvertex *allocVertex()
 {
@@ -284,7 +288,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 );