Hi Thomas,

Basically, I agree with this patch as PciIoDevice->BusNumberRanges equals 
Configuration from PciResAlloc->StartBusEnumeration, and according to PI spec 
"Because the size of ACPI resource descriptors is not fixed, 
StartBusEnumeration() is responsible for allocating memory for the buffer 
Configuration".

But I hope Ruiyu can double confirm it.
Since Ruiyu is taking leave for some days, could you wait?



Thanks,
Star
-----Original Message-----
From: Thomas Palmer [mailto:[email protected]] 
Sent: Tuesday, July 3, 2018 11:33 PM
To: [email protected]
Cc: Dong, Eric <[email protected]>; Zeng, Star <[email protected]>; Ni, 
Ruiyu <[email protected]>; [email protected]; [email protected]; Thomas 
Palmer <[email protected]>
Subject: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in 
FreePciDevice

When cleaning the PciIoDevice, also free the BusNumberRange

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Palmer <[email protected]>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index ad7a2337f578..48cf57a24f8f 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -2,6 +2,7 @@
   Supporting functions implementaion for PCI devices management.
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<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 @@ -105,6 +106,10 
@@ FreePciDevice (
     FreePool (PciIoDevice->DevicePath);
   }
 
+  if (PciIoDevice->BusNumberRanges != NULL) {
+    FreePool (PciIoDevice->BusNumberRanges);  }
+
   FreePool (PciIoDevice);
 }
 
--
2.7.4

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to