summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeng Tian <feng.tian@intel.com>2015-04-10 06:02:00 +0000
committererictian <erictian@Edk2>2015-04-10 06:02:00 +0000
commit6a54db85969304f4d4ad68580bf2141cc62e0779 (patch)
tree7a9ee41b79ef409142c8c1ef1c54ac87b5355ac5
parentd9a55c78e50584b9d1e0c239342b3a432ad59228 (diff)
MdeModulePkg/NvmExpressDxe: Fix possible memory leak issue in NvmExpressDxe driver.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17156 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
index ee40ba05c..7d6d798e1 100644
--- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
+++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c
@@ -2,7 +2,7 @@
NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows
NVM Express specification.
- Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -104,6 +104,7 @@ EnumerateNvmeDevNamespace (
//
Device = AllocateZeroPool(sizeof(NVME_DEVICE_PRIVATE_DATA));
if (Device == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
goto Exit;
}
@@ -250,6 +251,10 @@ Exit:
FreePool (NamespaceData);
}
+ if (NewDevicePathNode != NULL) {
+ FreePool (NewDevicePathNode);
+ }
+
if(EFI_ERROR(Status) && (Device != NULL) && (Device->DevicePath != NULL)) {
FreePool (Device->DevicePath);
}
@@ -395,6 +400,8 @@ UnregisterNvmeNamespace (
FreeUnicodeStringTable (Device->ControllerNameTable);
}
+ FreePool (Device);
+
return EFI_SUCCESS;
}