summaryrefslogtreecommitdiff
path: root/userland/libc/stdio/vdprintf.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-03 15:08:45 +0200
committerAnton Kling <anton@kling.gg>2024-10-03 15:08:45 +0200
commit226d861c9ebb7f09f95665d07d9ab5c6b7ed7d6f (patch)
treed900c3437d3d65ee7bd88474586dc6dd947b14ce /userland/libc/stdio/vdprintf.c
parent64b0b49a1f23da9faa680f8158cb8a12cd4d118c (diff)
libc: small changes
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;
}