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 A965FAC0E11 for ; Sun, 10 Mar 2024 10:42:01 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=0qYFrCEnfNwA0gjCv0aelI68F+zmLk9ZgYGa2NvvNb4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1710067320; v=1; b=VIwQF/oF9b9svr0q9pCb63FOmSM8TsTyRPiO8nMsHEryaOtJK4BDoqDD5IoPk2JvsGL5UayN E3WMLHNsb/XAiRto6/ZiPkIMTI6O5UhNmmC8wGcxGZccqgczbGOskk0R/rNM8Fjkx3yxOb3iheR XYH/1FQUrlS2/oOb9guLjkev4mSg4H6ynSiyD4J8IYZVxGDxqWb+5rNrDJ5t4rliEQf2FKLtC4/ fc5Z0ck98fy8OKer3RU7BcsUxTM7faH2G4zbN+db5F0idQCldGFK8sx7rP9+Ldi3cvDN78lQ3su Rdg54B3mmtIi+Br/WT9tXob2qpuElvnjq/SrO2TpxF6Aw== X-Received: by 127.0.0.2 with SMTP id gFzyYY7687511xOhjex9jEFl; Sun, 10 Mar 2024 03:42:00 -0700 X-Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by mx.groups.io with SMTP id smtpd.web11.31621.1710067318772759490 for ; Sun, 10 Mar 2024 03:41:59 -0700 X-Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d288bac3caso29451851fa.2 for ; Sun, 10 Mar 2024 03:41:58 -0700 (PDT) X-Gm-Message-State: y77vMBfOdA9QZepnLHz4uXSUx7686176AA= X-Google-Smtp-Source: AGHT+IHJCUOe/qfFjCj38HCl5jxXL2c9gfM4Y6GHF8eClGam+crfWov6hqgrM2qdqoJT9XyLJ1sl/Q== X-Received: by 2002:a2e:2c0f:0:b0:2d4:430:b0e5 with SMTP id s15-20020a2e2c0f000000b002d40430b0e5mr2027843ljs.44.1710067316670; Sun, 10 Mar 2024 03:41:56 -0700 (PDT) X-Received: from localhost.localdomain ([195.91.209.163]) by smtp.gmail.com with ESMTPSA id z8-20020a2e9648000000b002d3202b2b90sm614238ljh.87.2024.03.10.03.41.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 10 Mar 2024 03:41:56 -0700 (PDT) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: Mike Maslenkin , Abner Chang , Igor Kulchytskyy , Nickle Wang Subject: [edk2-devel] [PATCH 2/4][edk2-redfish-client] RedfishClientPkg: fix leak in provisioning properties functions Date: Sun, 10 Mar 2024 03:41:59 -0700 Message-Id: <20240310104151.41355-3-mike.maslenkin@gmail.com> In-Reply-To: <20240310104151.41355-1-mike.maslenkin@gmail.com> References: <20240310104151.41355-1-mike.maslenkin@gmail.com> MIME-Version: 1.0 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,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: 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="VIwQF/oF"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io The structure instance retunred by ToStructure() must be deallocated properly. Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nickle Wang Signed-off-by: Mike Maslenkin --- RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c | 5 ++++- .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c | 5 ++++- .../Features/Memory/V1_7_1/Common/MemoryCommon.c | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c b/Re= dfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c index 1eb269a84222..f40fe215afeb 100644 --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c @@ -247,7 +247,6 @@ ProvisioningBiosProperties ( );=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status));= =0D - return Status;=0D }=0D =0D //=0D @@ -258,6 +257,10 @@ ProvisioningBiosProperties ( (EFI_REST_JSON_STRUCTURE_HEADER *)Bios=0D );=0D =0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);=0D }=0D =0D diff --git a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionC= ommon.c b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionComm= on.c index 339c8ba04103..358b32253973 100644 --- a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c +++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c @@ -334,7 +334,6 @@ ON_RELEASE: );=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status));= =0D - return Status;=0D }=0D =0D //=0D @@ -345,6 +344,10 @@ ON_RELEASE: (EFI_REST_JSON_STRUCTURE_HEADER *)BootOption=0D );=0D =0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);=0D }=0D =0D diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c = b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c index e873f05ca040..39ec7ec0c34b 100644 --- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c +++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c @@ -2133,7 +2133,6 @@ ProvisioningMemoryProperties ( );=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status));= =0D - return Status;=0D }=0D =0D //=0D @@ -2144,6 +2143,10 @@ ProvisioningMemoryProperties ( (EFI_REST_JSON_STRUCTURE_HEADER *)Memory=0D );=0D =0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);=0D }=0D =0D --=20 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116566): https://edk2.groups.io/g/devel/message/116566 Mute This Topic: https://groups.io/mt/104841893/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-