From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 94632941A56 for ; Mon, 11 Mar 2024 13:19:07 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bmjZaHzKKbOiBlpocCO3IqRqT4W+kyCSJdcgZtwjzy0=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1710163146; v=1; b=psnXPF675oWUPjt/SQ/JVfgvXpjY4ZQkS2juz2Z+GGSIV7xjjbf3JbCjwDwcWRv2N3+Vop82 CFoaZ1t6fPSdhh0l21F5T2g9rS/cGwriWYH4GS40D8gNQo79J8GfohXKUhaMs8mWkygtrwOdocc BjZUpvsYbVfMmUVrKeXRcI5K00V8AxRPgxWn17GV/jvEMzJI/hqSkKd4V/KuORKPeV/fFhTooKt Kwyi4X/z3IK6FRgIIvdQDVThk5qBMeJOAproIfaXMFLj9LR1JAePg+BSaE0IPI7tdp1YmvNi8n1 VrMwpXC5JW7h8iyDjY7tVWentNvS+rUpuSc0NJYfcYhAg== X-Received: by 127.0.0.2 with SMTP id yu7RYY7687511x37p9tWEaht; Mon, 11 Mar 2024 06:19:06 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web10.62522.1710163145689401727 for ; Mon, 11 Mar 2024 06:19:05 -0700 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by CYYPR12MB8750.namprd12.prod.outlook.com (2603:10b6:930:be::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.34; Mon, 11 Mar 2024 13:19:02 +0000 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::fef9:2c9c:21b5:6f50]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::fef9:2c9c:21b5:6f50%2]) with mapi id 15.20.7362.035; Mon, 11 Mar 2024 13:19:02 +0000 From: "Nickle Wang via groups.io" To: "devel@edk2.groups.io" , "mike.maslenkin@gmail.com" CC: Abner Chang , Igor Kulchytskyy Subject: Re: [edk2-devel] [PATCH 4/4][edk2-redfish-client] RedfishClientPkg: fix memory leak Thread-Topic: [edk2-devel] [PATCH 4/4][edk2-redfish-client] RedfishClientPkg: fix memory leak Thread-Index: AQHacteYwBhJJpgmZEioxhUMDLALX7Eyh60A Date: Mon, 11 Mar 2024 06:19:05 -0700 Message-ID: References: <20240310104151.41355-1-mike.maslenkin@gmail.com> <20240310104151.41355-5-mike.maslenkin@gmail.com> In-Reply-To: <20240310104151.41355-5-mike.maslenkin@gmail.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|CYYPR12MB8750:EE_ x-ms-office365-filtering-correlation-id: 620210c5-293f-4cb3-6abf-08dc41cdd1c6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: D3dkdvB9dtJ5oF+z61JBiQxA5HegMhXSyV6sxhBz0e3MZw93yhOH/8H1R3D05Zy3B8MJFEy8R+BBpuTG16gOdVPAn/8mHmDjjfgpAqyB3vaS8b7zGxtzlOktJkSYg0pxWr12G+BeMNLGcH5IR1+sHkQbQSIB95rDEPWbP/GXf3hOXASBHAkHAyvEQi5CA4psRWxK7C4e0tSYELwbcsFhEqqTnD8fP2LK9mIOZoxydZIqM2xRaa+QJJCAzKGUSHyDWzJgS1jT2Rc3UFhzQZzKAKj1aAo1rtV77MDlVdbkCxpI+dg6g6TRCt7+pFqHd8/mhGBSdIFyeZdOQOt58Iz60Bd9MkTEapLznJ+ZNPfZ911gPH4AsNseiZCFtEs/H2REjAx1pIux6zASik6XzdBsrXvir1sVAVxBpKTL1ZcsgZqOXVxcFHkh7stw5cxuHr6FvI5Qq5ppUxqhtpy93t39QeiGsoU27qWqFeyxMjSp0FWrRoOWjC2CfQCxEtyLOC5BJTEhpDwyviTuty8UoecvAB5dNmyYX1InQByb8CUEhpwvc5EraxkLkRjrwbGGKMMkdkPsxU8G3pnqOApY9KTslA5HvsjCr1XO/ZNq6bzR3mI9zDieZGKWbB1m8BopMPhBlvHJeEbn5aiBOkIUTQ8d/aU8zgYlVhcP1rbX7b6SFE4= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RiHhqvAGCzZ9zeiXroQqGrJUZQuhccS7eUI4SwMES5oULsuBZFIBArSkIpBR?= =?us-ascii?Q?GGiOfVjcqSDszI/6eAHAnZ3XZovmx1+djKbkkg32iGfId5NMlAw4C+rf4/Aw?= =?us-ascii?Q?Dj9IzVB7n+qQ2y18j8hxU8PqqCquNjwSzI2RBJzy5UAMa454G/C/RBcb9Qsd?= =?us-ascii?Q?uFotfDaj9sVMdQmHNtR94pEb3OxCMfHVWjUhVL49brsQJebj2No/LVAFEaoj?= =?us-ascii?Q?1R1LoXkii+pakqJ55mag3BWGLAt+hsa6FpMjOXXmhOn5MoUCphj25Idxel7I?= =?us-ascii?Q?LVkfV8+AV/vXcF6VM1vZGpNPwKx5YMfjvD9u8ZDtWv116MpiyvSPZUYtnEdT?= =?us-ascii?Q?JdhscCLSxIdRPLuggajkV+tZ30A1bt8runxGNFu+BJRO5MKhOsBBzC/LtedM?= =?us-ascii?Q?l82q3toKuOI3pKlsfVE89EYRR7exW5Wxj4lCryKuK1RFEoin2CAYKQTP8j/E?= =?us-ascii?Q?8wtEMIOcLc5ghSb1+H1eSunrEIFOz08T/VAhkcsS5VLc6J7lXLU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HMCtqvnJ+26qPuHaWFvy0rm7sq9iha6znIf04LClFECWFaS9qObQn/?= =?us-ascii?Q?DFAnFgSuXf58RjRdJ8PjqvZw6mdO13XHxTTnSdJYVjedujhU7lnog1jECk6P?= =?us-ascii?Q?U5CraBzrJcH62o3mtvFeYfkfzlg7DMSXkwReO+4F5lvpXCFhPw2xhGWnobIl?= =?us-ascii?Q?e/taMW4kW2RFb3QWGCSmcnqMXvGn9mN+lMBVi8ts?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 620210c5-293f-4cb3-6abf-08dc41cdd1c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Mar 2024 13:19:02.3031 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1M2NJU6FtvrQ8XK16wxPHM3RWipGxA6YpYi4/YtlSZVbgY4tvFI5jgf6jGBSibss95r/NE1ZubjXI7J2TfMifg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8750 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ST6FAdPOZ7P7DT7oRQNZ7ceex7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=psnXPF67; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Nickle Wang Regards, Nickle > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Mike > Maslenkin via groups.io > Sent: Sunday, March 10, 2024 6:42 PM > To: devel@edk2.groups.io > Cc: Mike Maslenkin ; Abner Chang > ; Igor Kulchytskyy ; Nickle Wang > > Subject: [edk2-devel] [PATCH 4/4][edk2-redfish-client] RedfishClientPkg: = fix > memory leak >=20 > External email: Use caution opening links or attachments >=20 >=20 > The structure instance retunred by ToStructure() must be deallocated prop= erly. >=20 > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nickle Wang > Signed-off-by: Mike Maslenkin > --- > .../v1_5_0/RedfishResourceIdentifyLibComputerSystem.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git > a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_= 0/ > RedfishResourceIdentifyLibComputerSystem.c > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_= 0/ > RedfishResourceIdentifyLibComputerSystem.c > index 29b4f525d5ff..2f177b8032cc 100644 > --- > a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/v1_5_= 0/ > RedfishResourceIdentifyLibComputerSystem.c > +++ b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSystem/ > +++ v1_5_0/RedfishResourceIdentifyLibComputerSystem.c > @@ -70,19 +70,20 @@ RedfishIdentifyResource ( > ComputerSystemCs =3D ComputerSystem->ComputerSystem; >=20 >=20 >=20 > if (IS_EMPTY_STRING (ComputerSystemCs->UUID)) { >=20 > - return FALSE; >=20 > + Status =3D EFI_NOT_FOUND; >=20 > + goto ON_RELEASE; >=20 > } >=20 >=20 >=20 > Status =3D AsciiStrToGuid (ComputerSystemCs->UUID, &ResourceUuid); >=20 > if (EFI_ERROR (Status)) { >=20 > DEBUG ((DEBUG_ERROR, "%a, fail to get resource UUID: %r\n", __func__= , > Status)); >=20 > - return FALSE; >=20 > + goto ON_RELEASE; >=20 > } >=20 >=20 >=20 > Status =3D NetLibGetSystemGuid (&SystemUuid); >=20 > if (EFI_ERROR (Status)) { >=20 > DEBUG ((DEBUG_ERROR, "%a, fail to get system UUID from SMBIOS: %r\n"= , > __func__, Status)); >=20 > - return FALSE; >=20 > + goto ON_RELEASE; >=20 > } >=20 >=20 >=20 > DEBUG ((REDFISH_DEBUG_TRACE, "%a, Identify: System: %g Resource: %g\n"= , > __func__, &SystemUuid, &ResourceUuid)); >=20 > @@ -92,6 +93,8 @@ RedfishIdentifyResource ( > Status =3D EFI_UNSUPPORTED; >=20 > } >=20 >=20 >=20 > +ON_RELEASE: >=20 > + >=20 > mJsonStructProtocol->DestoryStructure ( >=20 > mJsonStructProtocol, >=20 > (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSyste= m >=20 > -- > 2.32.0 (Apple Git-132) >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#116568): https://edk2.groups.io/g/devel/message/11656= 8 > Mute This Topic: https://groups.io/mt/104841896/7129762 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [nicklew@nvidia.com] -= =3D-=3D- > =3D-=3D-=3D-=3D >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116627): https://edk2.groups.io/g/devel/message/116627 Mute This Topic: https://groups.io/mt/104841896/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-