[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fwts-devel
Subject:    ACK: [PATCH] uefi: uefirtvariable: fix a memory leak of variablename
From:       ivanhu <ivan.hu () canonical ! com>
Date:       2020-04-08 7:28:39
Message-ID: 4a22cee4-1512-0c68-1991-6ed38932e45e () canonical ! com
[Download RAW message or body]



On 4/8/20 1:44 AM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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@canonical.com>

-- 
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic