From: Jan Kiszka <[email protected]>

This fixes a regression caused by premature cleanup: If
probe_config_file() ran successfully and found an already mounted
partition, its mountpoint must not be released yet. bgenv_finalize()
will take care of that.

However, if probe_config_file() failed, it must free any previously
created mountpoint string prior to returning. That is what c2be7c1b95b4
was actually trying to resolve.

Reported-by: Ingo Rah <[email protected]>
Fixes: c2be7c1b95b4 ("libebgenv: fix memory leak in partition probing")
Signed-off-by: Jan Kiszka <[email protected]>
---
 env/env_config_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/env/env_config_file.c b/env/env_config_file.c
index b0cf043..03c618a 100644
--- a/env/env_config_file.c
+++ b/env/env_config_file.c
@@ -85,7 +85,7 @@ bool probe_config_file(CONFIG_PART *cfgpart)
                }
                if (do_unmount) {
                        unmount_partition(cfgpart);
-               } else {
+               } else if (!result) {
                        free(cfgpart->mountpoint);
                        cfgpart->mountpoint = NULL;
                }
-- 
2.43.0

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/efibootguard-dev/e93c252a-ceb3-4d45-adfe-a2bebfc86d64%40siemens.com.

Reply via email to