From: Heinrich Schuchardt Date: Tue, 2 Oct 2018 03:30:05 +0000 (+0200) Subject: efi_loader: memory leak in efi_set_variable() X-Git-Tag: v2018.11-rc3~46^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dadc2bddb0c0e00554666ec39bc10b9d66409f24;p=platform%2Fkernel%2Fu-boot.git efi_loader: memory leak in efi_set_variable() Do not leak native_name if out of memory. This addresses CoverityScan CID 184095. Reported-by: Tom Rini Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index a1313fa..19d9cb8 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;