From: Hosgor, Tolga (IOT DS EU TR MTS) <
tolga....@siemens.com>
In cases where get_mountpoint() returns non-null, do_unmount is not set
to true and umount_partition() is not called. This results in
cfgpart->mountpoint to not be freed.
Signed-off-by: Hosgor, Tolga (IOT DS EU TR MTS) <
tolga....@siemens.com>
---
env/env_config_file.c | 3 +++
tools/tests/test_probe_config_file.c | 1 -
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/env/env_config_file.c b/env/env_config_file.c
index 873fe10..9b96f20 100644
--- a/env/env_config_file.c
+++ b/env/env_config_file.c
@@ -88,6 +88,9 @@ bool probe_config_file(CONFIG_PART *cfgpart)
}
if (do_unmount) {
unmount_partition(cfgpart);
+ } else {
+ free(cfgpart->mountpoint);
+ cfgpart->mountpoint = NULL;
}
return result;
}
diff --git a/tools/tests/test_probe_config_file.c b/tools/tests/test_probe_config_file.c
index f1da154..9b1a176 100644
--- a/tools/tests/test_probe_config_file.c
+++ b/tools/tests/test_probe_config_file.c
@@ -120,7 +120,6 @@ bool __wrap_probe_config_file(CONFIG_PART *cp)
cp->not_mounted = false;
ret = __real_probe_config_file(cp);
- free(cp->mountpoint);
return ret;
}
--
2.24.1