From c098363245382f94175baed9dc284dfc239f4ef0 Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Tue, 17 Oct 2023 12:34:28 +0200 Subject: [PATCH] libebgenv: fix memory leak in partition probing When probing partitions, the mountpoint string is allocated on the heap. Normally the mountpoint is freed during unmounting. But for partitions that are already mounted, we also need to free the mountpoint str. Signed-off-by: Felix Moessbauer Signed-off-by: Jan Kiszka --- env/env_config_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env/env_config_file.c b/env/env_config_file.c index c9cc99f..67dee7d 100644 --- a/env/env_config_file.c +++ b/env/env_config_file.c @@ -85,6 +85,8 @@ bool probe_config_file(CONFIG_PART *cfgpart) } if (do_unmount) { unmount_partition(cfgpart); + } else { + free(cfgpart->mountpoint); } return result; }