summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-08 03:10:37 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2012-05-08 03:10:37 +0000
commitd2c243e1991273df3fa6037c6bb675ac1c7551f4 (patch)
treecfbed627368e29ef7a5f8d7c3c056a7a46e239fb /MdeModulePkg
parent1c0cc375aa881b330e7b94bc8f8fd179cc6d1bfd (diff)
downloadedk2-d2c243e1991273df3fa6037c6bb675ac1c7551f4.tar.gz
edk2-d2c243e1991273df3fa6037c6bb675ac1c7551f4.tar.bz2
edk2-d2c243e1991273df3fa6037c6bb675ac1c7551f4.zip
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
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Image/Image.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c
index e51a9fe174..9a143284e7 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -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;
}