systemd/0008-journald-fix-memory-leak-on-error-path.patch

30 lines
990 B
Diff
Raw Normal View History

From 26d8ff04914a5208d029e899682cd314b7714bf0 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 3 Nov 2014 23:10:34 +0100
Subject: [PATCH] journald: fix memory leak on error path
---
src/journal/journal-vacuum.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git src/journal/journal-vacuum.c src/journal/journal-vacuum.c
index d141fe0..80723c4 100644
--- src/journal/journal-vacuum.c
+++ 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;
--
1.7.9.2