]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Fix memory leaks
authorŁukasz Stelmach <l.stelmach@samsung.com>
Tue, 21 Jun 2022 10:12:01 +0000 (12:12 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 22 Jun 2022 00:31:17 +0000 (01:31 +0100)
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.

src/core/main.c

index ccbab04d274c8805c0d28d6eb7ba03ca0d03a8f9..18ba2b063c9a0ca13e540e722f2115181d544a1a 100644 (file)
@@ -2377,8 +2377,8 @@ static void reset_arguments(void) {
         arg_reboot_watchdog = 10 * USEC_PER_MINUTE;
         arg_kexec_watchdog = 0;
         arg_pretimeout_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_watchdog_pretimeout_governor = mfree(arg_watchdog_pretimeout_governor);
 
         arg_default_environment = strv_free(arg_default_environment);