summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-03 23:10:34 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-03 23:10:34 +0100
commit26d8ff04914a5208d029e899682cd314b7714bf0 (patch)
tree1128ed77d935c456e1555ee6036b54433cd48a04 /src
parent332076b45b8a78f018ade2dfdc7e4279a56d49cc (diff)
journald: fix memory leak on error path
Diffstat (limited to 'src')
-rw-r--r--src/journal/journal-vacuum.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index d141fe0ffb..80723c47f0 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -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;