Fix the potential issue that NULL pointer may be referred in LoadImage().

Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Rui Sun <rui.sun@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13293 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2012-05-08 03:10:37 +00:00
parent 1c0cc375aa
commit d2c243e199
1 changed files with 11 additions and 2 deletions

View File

@ -1353,6 +1353,7 @@ CoreLoadImage (
{
EFI_STATUS Status;
UINT64 Tick;
EFI_HANDLE Handle;
Tick = 0;
PERF_CODE (
@ -1372,8 +1373,16 @@ CoreLoadImage (
EFI_LOAD_PE_IMAGE_ATTRIBUTE_RUNTIME_REGISTRATION | EFI_LOAD_PE_IMAGE_ATTRIBUTE_DEBUG_IMAGE_INFO_TABLE_REGISTRATION
);
PERF_START (*ImageHandle, "LoadImage:", NULL, Tick);
PERF_END (*ImageHandle, "LoadImage:", NULL, 0);
Handle = NULL;
if (!EFI_ERROR (Status)) {
//
// ImageHandle will be valid only Status is success.
//
Handle = *ImageHandle;
}
PERF_START (Handle, "LoadImage:", NULL, Tick);
PERF_END (Handle, "LoadImage:", NULL, 0);
return Status;
}