journald: fix memory leak on error path

This commit is contained in:
Lennart Poettering 2014-11-03 23:10:34 +01:00
parent 332076b45b
commit 26d8ff0491

View file

@ -283,7 +283,11 @@ int journal_directory_vacuum(
patch_realtime(directory, p, &st, &realtime); patch_realtime(directory, p, &st, &realtime);
GREEDY_REALLOC(list, n_allocated, n_list + 1); if (!GREEDY_REALLOC(list, n_allocated, n_list + 1)) {
free(p);
r = -ENOMEM;
goto finish;
}
list[n_list].filename = p; list[n_list].filename = p;
list[n_list].usage = 512UL * (uint64_t) st.st_blocks; list[n_list].usage = 512UL * (uint64_t) st.st_blocks;