Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37617494
en ru br
ALT Linux repos
S:15.7-alt3

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


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
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin