summaryrefslogtreecommitdiffstats
path: root/common/eurephia_nullsafe.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/eurephia_nullsafe.h')
-rw-r--r--common/eurephia_nullsafe.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/eurephia_nullsafe.h b/common/eurephia_nullsafe.h
index fde8c2f..70c09d3 100644
--- a/common/eurephia_nullsafe.h
+++ b/common/eurephia_nullsafe.h
@@ -83,6 +83,9 @@ void *__malloc_nullsafe(eurephiaCTX *, size_t, const char *, int);
*/
#define malloc_nullsafe(ctx, sz) __malloc_nullsafe(ctx, sz, __FILE__, __LINE__)
+
+void inline __free_nullsafe(eurephiaCTX *ctx, void *ptr, const char *file, int line);
+
/**
* free() wrapper. Frees memory allocated by malloc() or calloc(). It also sets the
* input pointer to NULL on success.
@@ -90,7 +93,7 @@ void *__malloc_nullsafe(eurephiaCTX *, size_t, const char *, int);
* @param ptr Pointer to the memory region being freed.
*
*/
-#define free_nullsafe(ptr) if( ptr != NULL ) { free(ptr); ptr = NULL; }
+#define free_nullsafe(ctx, ptr) { __free_nullsafe(ctx, ptr, __FILE__, __LINE__); ptr = NULL; }
/**