ACK: [PATCH] uefirtvariable: fix memory leak

Alex Hung alex.hung at canonical.com
Fri May 14 23:39:14 UTC 2021


On 2021-05-14 2:00 a.m., Ivan Hu wrote:
> Also add void for the ioctl which is intentional ignore return for
> deleting variable.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/uefi/uefirtvariable/uefirtvariable.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
> index b756ac96..f5aaa5fb 100644
> --- a/src/uefi/uefirtvariable/uefirtvariable.c
> +++ b/src/uefi/uefirtvariable/uefirtvariable.c
> @@ -2223,7 +2223,7 @@ static int uefirtvariable_test9(fwts_framework *fw)
>  	/* delete the variable which was set */
>  	setvariable.DataSize = 0;
>  	status = ~0ULL;
> -	ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
> +	(void)ioctl(fd, EFI_RUNTIME_SET_VARIABLE, &setvariable);
>  
>  	variablename = malloc(sizeof(uint16_t) * variablenamesize);
>  	if (!variablename) {
> @@ -2300,6 +2300,9 @@ static int uefirtvariable_test9(fwts_framework *fw)
>  	} else
>  		fwts_skipped(fw, "QueryVarInfo runtime service supported, skip test.");
>  
> +	if (variablename)
> +		free(variablename);
> +
>  	return FWTS_OK;
>  }
>  
> 

Acked-by: Alex Hung <alex.hung at canonical.cmo>



More information about the fwts-devel mailing list