PATCH: missing free() in vasprintf() in openbsd-compat
Jan Pechanec
Jan.Pechanec at Sun.COM
Fri Sep 14 01:07:55 EST 2007
hi, it can hardly be considered a memleak since I can see that the
ret value is always checked in parent code (xasprintf() for example) and
fatal() called if it's equal to -1 but the free() call is definitely missing
there.
--- bsd-asprintf.c Tue Dec 5 12:58:12 2006
+++ bsd-asprintf.c.new Thu Sep 13 16:51:40 2007
@@ -55,6 +55,7 @@
if (ret >= 0 && ret < INIT_SZ) { /* succeeded with initial alloc */
*str = string;
} else if (ret == INT_MAX || ret < 0) { /* Bad length */
+ free(string);
goto fail;
} else { /* bigger than initial, realloc allowing for nul */
len = (size_t)ret + 1;
--
Jan Pechanec
More information about the openssh-unix-dev
mailing list