[PATCH] uefi: uefirtvariable: fix a memory leak of variablename
Colin King
colin.king at canonical.com
Tue Apr 7 17:44:39 UTC 2020
From: Colin Ian King <colin.king at canonical.com>
In the case where an ioctl fails the error handling currently
returns without freeing variablename. Fix this by setting ret
to FWTS_ERROR and falling through to the return path that
frees variable name and returns the error code.
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/uefi/uefirtvariable/uefirtvariable.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 3986d1d3..fb993983 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -466,12 +466,11 @@ err_restore_env:
status = ~0ULL;
ioret = ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
-
if (ioret == -1) {
fwts_failed(fw, LOG_LEVEL_HIGH, "UEFIRuntimeSetVariable",
"Failed to delete variable with UEFI runtime service.");
fwts_uefi_print_status_info(fw, status);
- return FWTS_ERROR;
+ ret = FWTS_ERROR;
}
if (variablename)
--
2.25.1
More information about the fwts-devel
mailing list