All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] efi_loader: memory leak in efi_set_variable()
@ 2018-10-02  3:30 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2018-10-02  3:30 UTC (permalink / raw)
  To: u-boot

Do not leak native_name if out of memory.

This addresses CoverityScan CID 184095.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/efi_variable.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index a1313fa215..19d9cb865f 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -294,8 +294,10 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor,
 	}
 
 	val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
-	if (!val)
-		return EFI_EXIT(EFI_OUT_OF_RESOURCES);
+	if (!val) {
+		ret = EFI_OUT_OF_RESOURCES;
+		goto out;
+	}
 
 	s = val;
 
-- 
2.19.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-02  3:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02  3:30 [U-Boot] [PATCH 1/1] efi_loader: memory leak in efi_set_variable() Heinrich Schuchardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.