MdeModulePkg PiSmmCore: Fix a bug in SmmLoadImage() in PiSmmCore that in-correct status codes may be returned.

Signed-off-by: Sun Rui <rui.sun@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13208 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
rsun3 2012-04-24 01:38:40 +00:00
parent 5559a41aad
commit b08b7ba451
1 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@
Depex - Dependency Expresion. Depex - Dependency Expresion.
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -406,7 +406,7 @@ SmmLoadImage (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
return Status; return Status;
} }
@ -423,7 +423,7 @@ SmmLoadImage (
Status = PeCoffLoaderGetImageInfo (&ImageContext); Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
return Status; return Status;
} }
@ -459,7 +459,7 @@ SmmLoadImage (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
return Status; return Status;
} }
@ -477,7 +477,7 @@ SmmLoadImage (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
return Status; return Status;
} }
@ -496,7 +496,7 @@ SmmLoadImage (
Status = PeCoffLoaderLoadImage (&ImageContext); Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
SmmFreePages (DstBuffer, PageCount); SmmFreePages (DstBuffer, PageCount);
return Status; return Status;
@ -508,7 +508,7 @@ SmmLoadImage (
Status = PeCoffLoaderRelocateImage (&ImageContext); Status = PeCoffLoaderRelocateImage (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
SmmFreePages (DstBuffer, PageCount); SmmFreePages (DstBuffer, PageCount);
return Status; return Status;
@ -532,7 +532,7 @@ SmmLoadImage (
Status = gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_LOADED_IMAGE_PROTOCOL), (VOID **)&DriverEntry->LoadedImage); Status = gBS->AllocatePool (EfiBootServicesData, sizeof (EFI_LOADED_IMAGE_PROTOCOL), (VOID **)&DriverEntry->LoadedImage);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
SmmFreePages (DstBuffer, PageCount); SmmFreePages (DstBuffer, PageCount);
return Status; return Status;
@ -553,7 +553,7 @@ SmmLoadImage (
Status = gBS->AllocatePool (EfiBootServicesData, GetDevicePathSize (FilePath), (VOID **)&DriverEntry->LoadedImage->FilePath); Status = gBS->AllocatePool (EfiBootServicesData, GetDevicePathSize (FilePath), (VOID **)&DriverEntry->LoadedImage->FilePath);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
if (Buffer != NULL) { if (Buffer != NULL) {
Status = gBS->FreePool (Buffer); gBS->FreePool (Buffer);
} }
SmmFreePages (DstBuffer, PageCount); SmmFreePages (DstBuffer, PageCount);
return Status; return Status;