From 6a54db85969304f4d4ad68580bf2141cc62e0779 Mon Sep 17 00:00:00 2001 From: Feng Tian Date: Fri, 10 Apr 2015 06:02:00 +0000 Subject: MdeModulePkg/NvmExpressDxe: Fix possible memory leak issue in NvmExpressDxe driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian Reviewed-by: Star Zeng 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c index ee40ba05c9..7d6d798e1f 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.
+ Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
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; } -- cgit v1.2.3