summaryrefslogtreecommitdiff
path: root/src/boot/efi/pe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/boot/efi/pe.c')
-rw-r--r--src/boot/efi/pe.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/boot/efi/pe.c b/src/boot/efi/pe.c
index 3755a36a68..f1f947b183 100644
--- a/src/boot/efi/pe.c
+++ b/src/boot/efi/pe.c
@@ -1,17 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
-/*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * Copyright (C) 2015 Kay Sievers <kay@vrfy.org>
- */
#include <efi.h>
#include <efilib.h>
@@ -125,7 +112,7 @@ EFI_STATUS pe_file_locate_sections(EFI_FILE *dir, CHAR16 *path, CHAR8 **sections
UINTN len;
UINTN headerlen;
EFI_STATUS err;
- CHAR8 *header = NULL;
+ _cleanup_freepool_ CHAR8 *header = NULL;
err = uefi_call_wrapper(dir->Open, 5, dir, &handle, path, EFI_FILE_MODE_READ, 0ULL);
if (EFI_ERROR(err))
@@ -166,9 +153,9 @@ EFI_STATUS pe_file_locate_sections(EFI_FILE *dir, CHAR16 *path, CHAR8 **sections
goto out;
err = uefi_call_wrapper(handle->Read, 3, handle, &len, header);
- if (EFI_ERROR(err)) {
+ if (EFI_ERROR(err))
goto out;
- }
+
if (len != headerlen) {
err = EFI_LOAD_ERROR;
goto out;
@@ -176,8 +163,6 @@ EFI_STATUS pe_file_locate_sections(EFI_FILE *dir, CHAR16 *path, CHAR8 **sections
err = pe_memory_locate_sections(header, sections, addrs, offsets, sizes);
out:
- if (header)
- FreePool(header);
uefi_call_wrapper(handle->Close, 1, handle);
return err;
}