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';
-- 
2.32.0

-- 
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/20210817094746.19936-1-christian.storm%40siemens.com.

Reply via email to