diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-03 23:10:34 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-03 23:10:34 +0100 |
commit | 26d8ff04914a5208d029e899682cd314b7714bf0 (patch) | |
tree | 1128ed77d935c456e1555ee6036b54433cd48a04 /src/journal | |
parent | 332076b45b8a78f018ade2dfdc7e4279a56d49cc (diff) |
journald: fix memory leak on error path
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-vacuum.c | 6 |
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; |