diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-01-10 00:24:24 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-01-10 00:24:24 -0800 |
| commit | f4a7b80b4ff63d6610142b417cbadd6526339ae4 (patch) | |
| tree | 1da87124f2fa4b935aa17eb25da100475ae49ff3 /utils.c | |
| parent | 9d1f51c483578c66d401a59f59ad18add0e1a52f (diff) | |
Updated more things to use xfree(&foo) instead of free(foo)
Diffstat (limited to 'utils.c')
| -rw-r--r-- | utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; } |
