From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 83B38203369FD for ; Fri, 6 Jul 2018 00:34:25 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2018 00:34:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,315,1526367600"; d="scan'208";a="213858556" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 06 Jul 2018 00:34:19 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 6 Jul 2018 00:34:19 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 6 Jul 2018 00:34:18 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.100]) with mapi id 14.03.0319.002; Fri, 6 Jul 2018 15:34:17 +0800 From: "Zeng, Star" To: Thomas Palmer , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Ni, Ruiyu" , "garyli@hpe.com" , "joseph.shifflett@hpe.com" , "Zeng, Star" Thread-Topic: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice Thread-Index: AQHUEuMlxJteH8KPM0qrAA4amyTAV6SB0I5g Date: Fri, 6 Jul 2018 07:34:16 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB7B8B2@shsmsx102.ccr.corp.intel.com> References: <1530631973-5775-1-git-send-email-thomas.palmer@hpe.com> In-Reply-To: <1530631973-5775-1-git-send-email-thomas.palmer@hpe.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreePciDevice X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jul 2018 07:34:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Thomas, Basically, I agree with this patch as PciIoDevice->BusNumberRanges equals C= onfiguration from PciResAlloc->StartBusEnumeration, and according to PI spe= c "Because the size of ACPI resource descriptors is not fixed, StartBusEnum= eration() 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:thomas.palmer@hpe.com]=20 Sent: Tuesday, July 3, 2018 11:33 PM To: edk2-devel@lists.01.org Cc: Dong, Eric ; Zeng, Star ; Ni,= Ruiyu ; garyli@hpe.com; joseph.shifflett@hpe.com; Thom= as Palmer Subject: [PATCH 1/1] MdeModulePkg/PciBusDxe: Fix small memory leak in FreeP= ciDevice When cleaning the PciIoDevice, also free the BusNumberRange Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Thomas Palmer --- MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModuleP= kg/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. =20 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made availab= le under the terms and conditions of the BSD License which accompanies thi= s distribution. The full text of the license may be found at @@ -105,6 +10= 6,10 @@ FreePciDevice ( FreePool (PciIoDevice->DevicePath); } =20 + if (PciIoDevice->BusNumberRanges !=3D NULL) { + FreePool (PciIoDevice->BusNumberRanges); } + FreePool (PciIoDevice); } =20 -- 2.7.4