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
This commit is contained in:
Feng Tian 2015-04-10 06:02:00 +00:00 committed by erictian
parent d9a55c78e5
commit 6a54db8596
1 changed files with 8 additions and 1 deletions

View File

@ -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;
}