MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice
authorThomas Palmer <thomas.palmer@hpe.com>
Tue, 3 Jul 2018 15:32:53 +0000 (23:32 +0800)
committerStar Zeng <star.zeng@intel.com>
Fri, 27 Jul 2018 00:59:31 +0000 (08:59 +0800)
When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <thomas.palmer@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c

index ad7a233..48cf57a 100644 (file)
@@ -2,6 +2,7 @@
   Supporting functions implementaion for PCI devices management.\r
 \r
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<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
@@ -105,6 +106,10 @@ FreePciDevice (
     FreePool (PciIoDevice->DevicePath);\r
   }\r
 \r
+  if (PciIoDevice->BusNumberRanges != NULL) {\r
+    FreePool (PciIoDevice->BusNumberRanges);\r
+  }\r
+\r
   FreePool (PciIoDevice);\r
 }\r
 \r