journald: fix memory leak on error path
This commit is contained in:
parent
332076b45b
commit
26d8ff0491
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue