From: Mark Wooding Date: Wed, 17 Jul 2024 11:54:39 +0000 (+0100) Subject: checkpath.c: Match `xmalloc' with `xfree', not `free'. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/checkpath/commitdiff_plain/de346a9e20c0463e25afea820d7578726f82d676 checkpath.c: Match `xmalloc' with `xfree', not `free'. A library can't reasonably assume that `arena_global' is still `arena_stdlib'. Fortunately, we don't retain allocations across calls, so we don't have to worry about `arena_global' being changed. --- diff --git a/checkpath.c b/checkpath.c index 5c047a5..4cf5181 100644 --- a/checkpath.c +++ b/checkpath.c @@ -139,7 +139,7 @@ static void pop(void) struct elt *e = sp->e_link; d.len = sp->e_offset; DPUTZ(&d); - free(sp); sp = e; + xfree(sp); sp = e; } } @@ -387,7 +387,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp) /* --- Strip off simple `.' elements --- */ if (strcmp(ee->e_name, ".") == 0) { - free(ee); + xfree(ee); ee = e; continue; } @@ -396,7 +396,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp) else if (strcmp(ee->e_name, "..") == 0) { pop(); - free(ee); + xfree(ee); ee = e; continue; } @@ -480,7 +480,7 @@ unsigned checkpath(const char *p, const struct checkpath *cp) report(cp, CP_ERROR, 0, 0, "junk left over after reaching leaf"); while (ee) { e = ee->e_link; - free(ee); + xfree(ee); ee = e; } }