Revision: 13704
          http://edk2.svn.sourceforge.net/edk2/?rev=13704&view=rev
Author:   lzeng14
Date:     2012-09-07 01:35:44 +0000 (Fri, 07 Sep 2012)
Log Message:
-----------
Fix the memory leak issue and enhance the check for CoreReadImageFile return.

Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Ting Ye <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/Dxe/Image/Image.c

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Image/Image.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Image/Image.c      2012-09-06 05:00:34 UTC 
(rev 13703)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Image/Image.c      2012-09-07 01:35:44 UTC 
(rev 13704)
@@ -389,7 +389,10 @@
      if (EFI_ERROR (Status)) {
        return Status;
      }
-     
+     if (Size != sizeof (EFI_IMAGE_SECTION_HEADER)) {
+       return EFI_NOT_FOUND;
+     }
+
      Status = EFI_NOT_FOUND;
      
      if ((SectionHeader.Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
@@ -1128,11 +1131,9 @@
     }
   }
 
-  if (Status == EFI_ALREADY_STARTED) {
+  if (EFI_ERROR (Status)) {
     Image = NULL;
     goto Done;
-  } else if (EFI_ERROR (Status)) {
-    return Status;
   }
 
   if (gSecurity2 != NULL) {
@@ -1194,7 +1195,8 @@
   //
   Image = AllocateZeroPool (sizeof(LOADED_IMAGE_PRIVATE_DATA));
   if (Image == NULL) {
-    return EFI_OUT_OF_RESOURCES;
+    Status = EFI_OUT_OF_RESOURCES;
+    goto Done;
   }
 
   //

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to