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; \ } \