From 2f5165d92f080f622c33b450068c7ed616df3ef5 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Tue, 3 Jan 2017 08:20:49 +0100 Subject: [PATCH] sync utils.c to sndiod one --- aucat/utils.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aucat/utils.c b/aucat/utils.c index 6598c6f..a1cfa8a 100644 --- a/aucat/utils.c +++ b/aucat/utils.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "utils.h" /* @@ -95,7 +96,7 @@ log_putx(unsigned long num) } /* - * store a unsigned decimal in the log + * store an unsigned decimal in the log */ void log_putu(unsigned long num) @@ -139,7 +140,7 @@ panic(void) } /* - * allocate a (small) abount of memory, and abort if it fails + * allocate a (small) amount of memory, and abort if it fails */ void * xmalloc(size_t size) @@ -162,6 +163,12 @@ xmalloc(size_t size) void xfree(void *p) { +#ifdef DEBUG + if (p == NULL) { + log_puts("xfree with NULL arg\n"); + panic(); + } +#endif free(p); }