fix: ASSERT on firmware update when capsule not found. (#2079)

Commit 74e12f7 introduced a case where FreePool could be called with an
unallocated pointer if no capsule image is found.

Signed-off-by: Bejean Mosher <bejean.mosher@intel.com>
This commit is contained in:
bejeanmo 2023-11-30 13:38:56 -05:00 committed by GitHub
parent 94ae656ba1
commit 16d855db39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1394,6 +1394,7 @@ InitFirmwareUpdate (
FwUpdStatusOffset = PcdGet32(PcdFwUpdStatusBase);
ResetRequired = FALSE;
FwPolicy.Data = 0;
CapsuleImage = NULL;
//
// Get capsule image.
@ -1452,7 +1453,9 @@ InitFirmwareUpdate (
if (EFI_ERROR (Status)) {
//
// Error condition
FreePool(CapsuleImage);
if (CapsuleImage != NULL) {
FreePool(CapsuleImage);
}
return Status;
}