diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-05-08 03:10:37 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-05-08 03:10:37 +0000 |
commit | d2c243e1991273df3fa6037c6bb675ac1c7551f4 (patch) | |
tree | cfbed627368e29ef7a5f8d7c3c056a7a46e239fb | |
parent | 1c0cc375aa881b330e7b94bc8f8fd179cc6d1bfd (diff) | |
download | edk2-d2c243e1991273df3fa6037c6bb675ac1c7551f4.zip edk2-d2c243e1991273df3fa6037c6bb675ac1c7551f4.tar.gz edk2-d2c243e1991273df3fa6037c6bb675ac1c7551f4.tar.bz2 |
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
-rw-r--r-- | MdeModulePkg/Core/Dxe/Image/Image.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index e51a9fe..9a14328 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;
}
|