1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

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

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-03-25 13:50:13 +01:00
parent a9899ff358
commit f1a8a66c35

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;