1 /* ========================================================================== */
2 /* === UMF_free ============================================================= */
3 /* ========================================================================== */
4 
5 /* -------------------------------------------------------------------------- */
6 /* Copyright (c) 2005-2012 by Timothy A. Davis, http://www.suitesparse.com.   */
7 /* All Rights Reserved.  See ../Doc/License.txt for License.                  */
8 /* -------------------------------------------------------------------------- */
9 
10 /*
11     Free a block previously allocated by UMF_malloc and return NULL.
12     Usage is p = UMF_free (p), to ensure that we don't free it twice.
13     Also maintains the UMFPACK malloc count.
14 */
15 
16 #include "umf_internal.h"
17 #include "umf_free.h"
18 
19 #if defined (UMF_MALLOC_COUNT) || !defined (NDEBUG)
20 #include "umf_malloc.h"
21 #endif
22 
UMF_free(void * p)23 GLOBAL void *UMF_free
24 (
25     void *p
26 )
27 {
28     DEBUG0 (("UMF_free: "ID"\n", (Int) p)) ;
29     if (p)
30     {
31 
32 	SuiteSparse_free (p) ;
33 
34 #if defined (UMF_MALLOC_COUNT) || !defined (NDEBUG)
35 	/* One more object has been free'd.  Keep track of the count. */
36 	/* (purely for sanity checks). */
37 	UMF_malloc_count-- ;
38 	DEBUG0 (("     new malloc count: "ID"\n", UMF_malloc_count)) ;
39 #endif
40 
41     }
42 
43     return ((void *) NULL) ;
44 }
45