From f1a8a66c35fbfe70d4f425e68becd8c1d1313464 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 25 Mar 2021 13:50:13 +0100 Subject: [PATCH] basic/fileio: use malloc_usable_size() to use all allocated memory --- src/basic/fileio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 7c370d4fc3c..a158ab080d7 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -426,6 +426,7 @@ int read_full_virtual_file(const char *filename, char **ret_contents, size_t *re buf = malloc(size + 1); if (!buf) return -ENOMEM; + size = malloc_usable_size(buf) - 1; /* Use a bigger allocation if we got it anyway */ for (;;) { ssize_t k; -- 2.47.3