summaryrefslogtreecommitdiff
path: root/libc/stdio/vasprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio/vasprintf.c')
-rw-r--r--libc/stdio/vasprintf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libc/stdio/vasprintf.c b/libc/stdio/vasprintf.c
index a901ee815..fa7926c60 100644
--- a/libc/stdio/vasprintf.c
+++ b/libc/stdio/vasprintf.c
@@ -39,6 +39,8 @@ int vasprintf(char **__restrict buf, const char * __restrict format,
if (rv < 0) {
free(*buf);
*buf = NULL;
+ } else {
+ *buf = realloc(*buf, rv + 1);
}
}