aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2023-12-07 14:36:36 +0200
committerTom Rini <trini@konsulko.com>2023-12-13 18:39:06 -0500
commiteb09c33084ca2106fa669bee402abea4e6e437dd (patch)
treebd8b60f779bc66fb951401a08d36c4a45140859a
parent09a17b0d01dd7c81f6fd96228581d7df47a1a7b1 (diff)
downloadu-boot-eb09c33084ca2106fa669bee402abea4e6e437dd.zip
u-boot-eb09c33084ca2106fa669bee402abea4e6e437dd.tar.gz
u-boot-eb09c33084ca2106fa669bee402abea4e6e437dd.tar.bz2
bootstd: Fix a memory leak in the efi manager bootflow
efi_get_var() allocates memory which has to be freed after the value of the variable is consumed. Free the memory properly Fixes: f2bfa0cb1794 ("bootstd: Make efi_mgr bootmeth work for non-sandbox setups") Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
-rw-r--r--boot/bootmeth_efi_mgr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/boot/bootmeth_efi_mgr.c b/boot/bootmeth_efi_mgr.c
index e6c42d4..6428c09 100644
--- a/boot/bootmeth_efi_mgr.c
+++ b/boot/bootmeth_efi_mgr.c
@@ -16,6 +16,7 @@
#include <dm.h>
#include <efi_loader.h>
#include <efi_variable.h>
+#include <malloc.h>
/**
* struct efi_mgr_priv - private info for the efi-mgr driver
@@ -65,6 +66,7 @@ static int efi_mgr_read_bootflow(struct udevice *dev, struct bootflow *bflow)
bootorder = efi_get_var(u"BootOrder", &efi_global_variable_guid,
&size);
if (bootorder) {
+ free(bootorder);
bflow->state = BOOTFLOWST_READY;
return 0;
}