ACK: [PATCH] uefi: uefirtvariable: fix a memory leak of variablename
ivanhu
ivan.hu at canonical.com
Wed Apr 8 07:28:39 UTC 2020
On 4/8/20 1:44 AM, Colin King wrote:
> 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)
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list