aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index 63511a3..724752d 100644
--- a/util.c
+++ b/util.c
@@ -58,7 +58,7 @@ void *
xreallocarray(void *buf, size_t n, size_t m)
{
buf = reallocarray(buf, n, m);
- if (!buf)
+ if (!buf && n && m)
fatal("reallocarray:");
return buf;
@@ -70,7 +70,7 @@ xmalloc(size_t len)
void *buf;
buf = malloc(len);
- if (!buf)
+ if (!buf && len)
fatal("malloc:");
return buf;