From 833cbf9d6799d338a3c756d5ef6984cad49b98aa Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Tue, 1 Nov 2022 01:55:43 +0000 Subject: [PATCH] Correct error message in FREE(). `FREE()` checks for a `NULL` pointer, but generally httpdirfs does not `NULL` out pointers it attempts to `FREE()` (or `free()`). As such, the error message is misleading; make it less so in a trivial way. Possibly a better, more invasive, change would be for `FREE()` to take a `void** pp`, check that `*p != NULL`, `free(*p)`, and then `*p = NULL;`. Were that done, then there would be some plausibility to the current diagnostic message. --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index 1ad431b..1e868f6 100644 --- a/src/util.c +++ b/src/util.c @@ -143,7 +143,7 @@ void FREE(void *ptr) if (ptr) { free(ptr); } else { - lprintf(fatal, "attempted to double free a pointer!\n"); + lprintf(fatal, "attempted to free NULL ptr!\n"); } }