summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
index 654e5c0..f428214 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
@@ -1001,10 +1001,6 @@ ScsiScanCreateDevice (
ScsiIoDevice->Lun,
&ScsiDevicePath
);
- if (Status == EFI_OUT_OF_RESOURCES) {
- FreePool (ScsiIoDevice);
- return Status;
- }
} else {
Status = ScsiIoDevice->ScsiPassThru->BuildDevicePath (
ScsiIoDevice->ScsiPassThru,
@@ -1012,10 +1008,11 @@ ScsiScanCreateDevice (
ScsiIoDevice->Lun,
&ScsiDevicePath
);
- if (Status == EFI_OUT_OF_RESOURCES) {
- FreePool (ScsiIoDevice);
- return Status;
- }
+ }
+
+ if (Status == EFI_OUT_OF_RESOURCES) {
+ FreePool (ScsiIoDevice);
+ return Status;
}
ScsiIoDevice->DevicePath = AppendDevicePathNode (
@@ -1043,6 +1040,7 @@ ScsiScanCreateDevice (
NULL
);
if (EFI_ERROR (Status)) {
+ FreePool (ScsiIoDevice->DevicePath);
FreePool (ScsiIoDevice);
return EFI_OUT_OF_RESOURCES;
} else {