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
1 changed files with 5 additions and 1 deletions

View File

@ -283,7 +283,11 @@ int journal_directory_vacuum(
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].usage = 512UL * (uint64_t) st.st_blocks;