basic/fileio: use malloc_usable_size() to use all allocated memory

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-03-26 15:54:56 +01:00
parent a9899ff358
commit f1a8a66c35
+1
View File
@@ -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;