From 9583878a7b31a37cfaca9a39d3884c06da7d1ae1 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 12 Apr 2017 07:41:11 +0100 Subject: [PATCH] Accept NULL pointer. --- compat/freezero.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compat/freezero.c b/compat/freezero.c index 916b120f..711a10c3 100644 --- a/compat/freezero.c +++ b/compat/freezero.c @@ -24,6 +24,8 @@ void freezero(void *ptr, size_t size) { - memset(ptr, 0, size); - free(ptr); + if (ptr != NULL) { + memset(ptr, 0, size); + free(ptr); + } }