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