On 17.08.21 11:47, Christian Storm wrote:
> From: Christian Storm <[email protected]>
> 
> buffer is AllocatePool()'d but not FreePool()'d on error
> conditions, resulting in a memory leak. Fix it by calling
> FreePool() on error exit paths.
> 
> Signed-off-by: Christian Storm <[email protected]>
> ---
>  utils.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/utils.c b/utils.c
> index 6238c8b..42ff741 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -89,10 +89,12 @@ CHAR16 *get_volume_custom_label(EFI_FILE_HANDLE fh)
>           fh->Open, 5, fh, &tmp, L"EFILABEL", EFI_FILE_MODE_READ,
>           EFI_FILE_ARCHIVE | EFI_FILE_HIDDEN | EFI_FILE_SYSTEM);
>       if (status != EFI_SUCCESS) {
> +             (VOID)FreePool(buffer);
>               return NULL;
>       }
>       status = uefi_call_wrapper(tmp->Read, 3, tmp, &buffsize, buffer);
>       if (status != EFI_SUCCESS) {
> +             (VOID)FreePool(buffer);
>               return NULL;
>       }
>       buffer[buffsize/sizeof(CHAR16)] = L'\0';
> 

Why "(VOID)"? We are not doing this so far.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/3d461db1-554e-0d1a-5f54-ee347347e59a%40siemens.com.

Reply via email to