Group :: System/Kernel and hardware
RPM: shim
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: shim-15.4-upstream-0030-fallback-free-the-right-variable-on-the-read_file-er.patch
Download
Download
From cff8db7d44c91c439cdbe5560dd6c43cae70ef6d Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 31 Aug 2021 16:01:03 -0400
Subject: [PATCH 30/35] fallback: free the right variable on the read_file()
error path.
Heinrich correctly noticed that read_file()'s memory allocation failure
error path tested the wrong variable, and thus would never catch the
error condition. The *next* error, file->Read() failing, has the same
incorrect variable usage in its FreePool() invocation.
This fixes it to free the right variable as well.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
fallback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fallback.c b/fallback.c
index 6a58a001..2eea8a74 100644
--- a/fallback.c
+++ b/fallback.c
@@ -166,7 +166,7 @@ read_file(EFI_FILE_HANDLE fh, CHAR16 *fullpath, CHAR16 **buffer, UINT64 *bs)
efi_status = fh->Read(fh, &len, b);
if (EFI_ERROR(efi_status)) {
- FreePool(buffer);
+ FreePool(b);
fh2->Close(fh2);
console_print(L"Could not read file: %r\n", efi_status);
return efi_status;
--
2.32.0