Skip to content

Commit 084bf69

Browse files
AZero13millert
authored andcommitted
Free *strp, not str in sudo
Set strsize to 0 afterwards to not write to str.
1 parent 13eb424 commit 084bf69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/util/snprintf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,9 @@ xxxprintf(char ** restrict strp, size_t strsize, int alloc, const char * restric
315315
char *t; \
316316
strsize = (strsize << 1) + 1; \
317317
if (!(t = realloc(*strp, strsize))) { \
318-
free(str); \
318+
free(*strp); \
319319
*strp = NULL; \
320+
strsize = 0; \
320321
ret = -1; \
321322
goto done; \
322323
} \

0 commit comments

Comments
 (0)