36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
From 12b790995c2d4fa86e1a316a78a8dff9f525541a Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= <l.stelmach@samsung.com>
|
|
Date: Tue, 21 Jun 2022 12:12:01 +0200
|
|
Subject: [PATCH] core: Fix memory leaks
|
|
|
|
arg_early_core_pattern and arg_watchdog_device hold pointers to memory
|
|
allocated with strdup() (inside path_make_absolute_cwd). The memory needs
|
|
to be freed in reset_arguments() during reload rather than forgotten.
|
|
|
|
(cherry picked from commit 919ea64f69f710840c1bc93f0f7cb7c51aae45d0)
|
|
|
|
Conflict:code context adaptation
|
|
Reference:https://github.com/systemd/systemd-stable/commit/12b790995c2d4fa86e1a316a78a8dff9f525541a
|
|
---
|
|
src/core/main.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/core/main.c b/src/core/main.c
|
|
index 409b84a006..f6d12cca04 100644
|
|
--- a/src/core/main.c
|
|
+++ b/src/core/main.c
|
|
@@ -2377,8 +2377,8 @@ static void reset_arguments(void) {
|
|
arg_runtime_watchdog = 0;
|
|
arg_reboot_watchdog = 10 * USEC_PER_MINUTE;
|
|
arg_kexec_watchdog = 0;
|
|
- arg_early_core_pattern = NULL;
|
|
- arg_watchdog_device = NULL;
|
|
+ arg_early_core_pattern = mfree(arg_early_core_pattern);
|
|
+ arg_watchdog_device = mfree(arg_watchdog_device);
|
|
|
|
arg_default_environment = strv_free(arg_default_environment);
|
|
arg_manager_environment = strv_free(arg_manager_environment);
|
|
--
|
|
2.33.0
|
|
|