fix: [Common] Fix Coverity issues

Fixed resource leak. Free resource prior to return (CWE 404)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
This commit is contained in:
Kevin Tsai 2023-07-31 17:58:17 -07:00 committed by Guo Dong
parent 971048cfc1
commit 74e12f7708
2 changed files with 3 additions and 0 deletions

View File

@ -1452,6 +1452,7 @@ InitFirmwareUpdate (
if (EFI_ERROR (Status)) {
//
// Error condition
FreePool(CapsuleImage);
return Status;
}

View File

@ -577,6 +577,7 @@ UpdateSystemFirmware (
Status = VerifyFwStruct (ImageHdr);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, " VerifyFwStruct failed with Status = 0x%x\n", Status));
FreePool(UpdatePartition);
return Status;
}
@ -655,6 +656,7 @@ UpdateSingleComponent (
DEBUG ((DEBUG_ERROR, "Updating component %4a failed with status = %r\n", (CHAR8 *)&CompName, Status));
}
FreePool(UpdatePartition);
return Status;
}