From ac231001f5c08356b236dc96aacb3015720cddf0 Mon Sep 17 00:00:00 2001 From: Tian Feng Date: Tue, 24 Nov 2015 14:35:28 +0800 Subject: MdeModulePkg/NvmExpress: Fix mem leak in error handling of Start() Memory pointed to by Private->ControllerData has not been freed up correctly at error handling path. Cc: Simon (Xiang) Lian-SSI Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian Reviewed-by: Star Zeng Reviewed-by: Simon (Xiang) Lian-SSI --- MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c index c379e178e1..54d637e7d0 100644 --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpress.c @@ -847,6 +847,10 @@ Exit: PciIo->FreeBuffer (PciIo, 4, Private->Buffer); } + if ((Private != NULL) && (Private->ControllerData != NULL)) { + FreePool (Private->ControllerData); + } + if (Private != NULL) { FreePool (Private); } -- cgit v1.2.3