Line data Source code
1 : //------------------------------------------------------------------------------ 2 : // LAGraph_Free: wrapper for free 3 : //------------------------------------------------------------------------------ 4 : 5 : // LAGraph, (c) 2019-2022 by The LAGraph Contributors, All Rights Reserved. 6 : // SPDX-License-Identifier: BSD-2-Clause 7 : // 8 : // For additional details (including references to third party source code and 9 : // other files) see the LICENSE file or contact permission@sei.cmu.edu. See 10 : // Contributors.txt for a full list of contributors. Created, in part, with 11 : // funding and support from the U.S. Government (see Acknowledgments.txt file). 12 : // DM22-0790 13 : 14 : // Contributed by Timothy A. Davis, Texas A&M University 15 : 16 : //------------------------------------------------------------------------------ 17 : 18 : // LAGraph_Free frees a block of memory obtained by LAGraph_Malloc. It does 19 : // nothing if p is NULL. 20 : 21 : #include "LG_internal.h" 22 : 23 46008 : int LAGraph_Free // free a block of memory and set p to NULL 24 : ( 25 : // input/output: 26 : void **p, // pointer to object to free, does nothing if NULL 27 : char *msg 28 : ) 29 : { 30 46008 : LG_CLEAR_MSG ; 31 : 32 46008 : if (p != NULL && (*p) != NULL) 33 : { 34 28769 : LAGraph_Free_function (*p) ; 35 28769 : (*p) = NULL ; 36 : } 37 : 38 46008 : return (GrB_SUCCESS) ; 39 : }