aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-01-10 00:24:24 -0800
committerBruce Hill <bruce@bruce-hill.com>2021-01-10 00:24:24 -0800
commitf4a7b80b4ff63d6610142b417cbadd6526339ae4 (patch)
tree1da87124f2fa4b935aa17eb25da100475ae49ff3 /utils.c
parent9d1f51c483578c66d401a59f59ad18add0e1a52f (diff)
Updated more things to use xfree(&foo) instead of free(foo)
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/utils.c b/utils.c
index c18ef9e..f13db19 100644
--- a/utils.c
+++ b/utils.c
@@ -214,9 +214,13 @@ int memicmp(const void *v1, const void *v2, size_t n)
/*
* Free memory, but also set the pointer to NULL for safety
*/
-void xfree(void **p)
+void xfree(void *p)
{
- free(*p);
+ if (*(void**)p == NULL) {
+ fprintf(stderr, "Attempt to free(NULL)\n");
+ _exit(1);
+ }
+ free(*(void**)p);
p = NULL;
}