diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-11-28 03:55:36 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-11-28 03:55:36 +0000 |
commit | 6a6d955c5f670141344c614c65dbea332f393b57 (patch) | |
tree | 80cb86cc7d44521d19279bb917146363376f67f1 /MdeModulePkg/Bus/Pci/UndiRuntimeDxe | |
parent | ac4f8b5abe6758183102be3feea30c7430eedf3a (diff) | |
download | edk2-platforms-6a6d955c5f670141344c614c65dbea332f393b57.tar.xz |
Fixed potential issues to release resources when error occurs.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4341 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Pci/UndiRuntimeDxe')
-rw-r--r-- | MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c index b79c5fe7a6..413ef32a7a 100644 --- a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c +++ b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c @@ -287,6 +287,7 @@ Returns: EFI_PCI_IO_PROTOCOL *PciIoFncs;
UINTN Len;
UINT64 Supports;
+ BOOLEAN PciAttributesSaved;
Status = gBS->OpenProtocol (
Controller,
@@ -321,6 +322,8 @@ Returns: return Status;
}
+ PciAttributesSaved = FALSE;
+
Status = gBS->AllocatePool (
EfiRuntimeServicesData,
sizeof (UNDI32_DEV),
@@ -344,8 +347,9 @@ Returns: );
if (EFI_ERROR (Status)) {
- return Status;
+ goto UndiErrorDeleteDevice;
}
+ PciAttributesSaved = TRUE;
//
// allocate and initialize both (old and new) the !pxe structures here,
@@ -550,15 +554,17 @@ UndiErrorDeletePxe: }
UndiErrorDeleteDevice:
- //
- // Restore original PCI attributes
- //
- PciIoFncs->Attributes (
- PciIoFncs,
- EfiPciIoAttributeOperationSet,
- UNDI32Device->NicInfo.OriginalPciAttributes,
- NULL
- );
+ if (PciAttributesSaved == TRUE) {
+ //
+ // Restore original PCI attributes
+ //
+ PciIoFncs->Attributes (
+ PciIoFncs,
+ EfiPciIoAttributeOperationSet,
+ UNDI32Device->NicInfo.OriginalPciAttributes,
+ NULL
+ );
+ }
gBS->FreePool (UNDI32Device);
|