]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/NvmExpressDxe: Fix possible memory leak issue in NvmExpressDxe driver.
authorFeng Tian <feng.tian@intel.com>
Fri, 10 Apr 2015 06:02:00 +0000 (06:02 +0000)
committererictian <erictian@Edk2>
Fri, 10 Apr 2015 06:02:00 +0000 (06:02 +0000)
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

MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c

index ee40ba05c9151f2a038a80fc9c4649f8c07ff08f..7d6d798e1f629de055c01c9a6b8d6d7655d8110b 100644 (file)
@@ -2,7 +2,7 @@
   NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows\r
   NVM Express specification.\r
 \r
-  Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -104,6 +104,7 @@ EnumerateNvmeDevNamespace (
     //\r
     Device = AllocateZeroPool(sizeof(NVME_DEVICE_PRIVATE_DATA));\r
     if (Device == NULL) {\r
+      Status = EFI_OUT_OF_RESOURCES;\r
       goto Exit;\r
     }\r
 \r
@@ -250,6 +251,10 @@ Exit:
     FreePool (NamespaceData);\r
   }\r
 \r
+  if (NewDevicePathNode != NULL) {\r
+    FreePool (NewDevicePathNode);\r
+  }\r
+\r
   if(EFI_ERROR(Status) && (Device != NULL) && (Device->DevicePath != NULL)) {\r
     FreePool (Device->DevicePath);\r
   }\r
@@ -395,6 +400,8 @@ UnregisterNvmeNamespace (
     FreeUnicodeStringTable (Device->ControllerNameTable);\r
   }\r
 \r
+  FreePool (Device);\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r