From: Zbigniew Jędrzejewski-Szmek Date: Thu, 25 Mar 2021 12:50:13 +0000 (+0100) Subject: basic/fileio: use malloc_usable_size() to use all allocated memory X-Git-Tag: v248-2~10^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f1a8a66c35fbfe70d4f425e68becd8c1d1313464;p=thirdparty%2Fsystemd.git basic/fileio: use malloc_usable_size() to use all allocated memory --- 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;