summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-08-31 16:01:03 -0400
committerRobbie Harwood <rharwood@redhat.com>2021-09-03 09:46:30 -0400
commitcff8db7d44c91c439cdbe5560dd6c43cae70ef6d (patch)
tree1aff17216a79df1689c3808d523538f2a93a13b0
parentc5784078a9078c0c2171aa42b458f34b2b175c74 (diff)
downloadefi-boot-shim-cff8db7d44c91c439cdbe5560dd6c43cae70ef6d.tar.gz
efi-boot-shim-cff8db7d44c91c439cdbe5560dd6c43cae70ef6d.zip
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>
-rw-r--r--fallback.c2
1 files changed, 1 insertions, 1 deletions
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;