summaryrefslogtreecommitdiff
path: root/userland/libc/stdio/vdprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/stdio/vdprintf.c')
-rw-r--r--userland/libc/stdio/vdprintf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/userland/libc/stdio/vdprintf.c b/userland/libc/stdio/vdprintf.c
index 2724c2e..01727c4 100644
--- a/userland/libc/stdio/vdprintf.c
+++ b/userland/libc/stdio/vdprintf.c
@@ -1,9 +1,12 @@
#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-size_t min(size_t a, size_t b) { return (a < b) ? a : b; }
+size_t min(size_t a, size_t b) {
+ return (a < b) ? a : b;
+}
int vdprintf(int fd, const char *format, va_list ap) {
FILE f = {
@@ -11,6 +14,10 @@ int vdprintf(int fd, const char *format, va_list ap) {
.fd = fd,
.fflush = fflush_fd,
.write_buffer = NULL,
+ .read_buffer = NULL,
};
- return vfprintf(&f, format, ap);
+ int rc = vfprintf(&f, format, ap);
+ free(f.write_buffer);
+ free(f.read_buffer);
+ return rc;
}