|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From a2e4c94df3d38cd2af73546ffd2623d9d1b20baa Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From: Lennart Poettering <lennart@poettering.net>
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Date: Mon, 3 Nov 2014 23:10:34 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Subject: [PATCH] journald: fix memory leak on error path
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
(cherry picked from commit 26d8ff04914a5208d029e899682cd314b7714bf0)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
src/journal/journal-vacuum.c | 6 +++++-
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
index 7699482a77..226af82da7 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
--- a/src/journal/journal-vacuum.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+++ b/src/journal/journal-vacuum.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -275,7 +275,11 @@ int journal_directory_vacuum(
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
patch_realtime(directory, p, &st, &realtime);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
- GREEDY_REALLOC(list, n_allocated, n_list + 1);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ if (!GREEDY_REALLOC(list, n_allocated, n_list + 1)) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ free(p);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ r = -ENOMEM;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ goto finish;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
list[n_list].filename = p;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
list[n_list].usage = 512UL * (uint64_t) st.st_blocks;
|