Changeset 426 for trunk/matml
- Timestamp:
- 02/23/2009 07:38:26 PM (3 years ago)
- Files:
-
- 1 modified
-
trunk/matml/src/ternary/qhull.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/matml/src/ternary/qhull.c
r425 r426 12 12 #include <stdlib.h> 13 13 #include <math.h> 14 15 16 static int qhull_lock=0; /*+ Lock for qhull memory and structures +*/ 14 17 15 18 … … 125 128 { printf ("qhullCalcHull: could not allocate memory for points\n"); 126 129 return -1; } 130 131 if (qhull_lock) 132 { printf ("Qhull use is currently locked\n"); return 1; } 133 qhull_lock=1; 134 127 135 for (i=0; i<numpoints; i++) 128 136 { … … 180 188 #endif 181 189 if (!(*facets = realloc (*facets, *numfacets * sizeof (hull_facet)))) 182 { printf ("hullReturnFacets: could not reallocate memory for vertices\n"); 183 return -1; } 190 { 191 printf ("hullReturnFacets: could not reallocate memory for vertices\n"); 192 free (qpoints); 193 qh_freeqhull (True); 194 qhull_lock=0; 195 return -1; 196 } 184 197 #ifdef DEBUG 185 198 printf (" post-realloc 0x%lx\n", *facets); … … 242 255 } 243 256 257 free (qpoints); 258 qh_freeqhull (True); 259 qhull_lock=0; 260 244 261 #ifdef DEBUG 245 262 printf ("After trimming loop: %d total facets, i=%d\n", *numfacets, i); … … 252 269 printf (" post-realloc 0x%lx\n", *facets); 253 270 #endif 254 255 free (qpoints);256 qh_freeqhull (True);257 271 258 272 return 0;