From 80267331dd05d7ed79214b3a3cb75f0fdfc394cf Mon Sep 17 00:00:00 2001 From: AZero13 Date: Wed, 17 Dec 2025 19:47:46 -0500 Subject: [PATCH] Free *strp, not str in sudo Set strsize to 0 afterwards to not write to str. --- lib/util/snprintf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util/snprintf.c b/lib/util/snprintf.c index 0d574d3740..2081a295d1 100644 --- a/lib/util/snprintf.c +++ b/lib/util/snprintf.c @@ -315,8 +315,9 @@ xxxprintf(char ** restrict strp, size_t strsize, int alloc, const char * restric char *t; \ strsize = (strsize << 1) + 1; \ if (!(t = realloc(*strp, strsize))) { \ - free(str); \ + free(*strp); \ *strp = NULL; \ + strsize = 0; \ ret = -1; \ goto done; \ } \