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 6C2D2D804B7 for ; Sun, 10 Mar 2024 10:42:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Rs/tz22H2m2oA6nLNHlPEb0J4mity8uUG+irErJWPnU=; 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=1710067322; v=1; b=CXHE6Wgm9qsS9XKL5eBMwlp5FkOdFKNwdYCg/H6ao/nHiuRDSdZF/tzSqOxDgljHLnUIiMF2 ghqvvPYXwX5W9WrDEO8YiZoY1mp5zT/wT1jKboA8v53WxRQq3wZASl//LGLC4j/DvwnN46eq+GZ 2CtxWzLOnBP4QgVgVGmOWADsgYeqAleATu7GAhZ3ZRLEMX8dq0mE38Q08F5ClsC3jGDL+tLIA2n 39HgM8+WGuEOsheCkfuJmAMbtOLQ5p5PFVEimlQEUz673g4GoE4VoLT6e+Id3LGi2/rdfk4U52e S5q264GtXYkQlsDExeoHJ4fB29GNXVIx2F+PQs3sxShng== X-Received: by 127.0.0.2 with SMTP id zEjpYY7687511xl6c9Nwe9pZ; Sun, 10 Mar 2024 03:42:02 -0700 X-Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by mx.groups.io with SMTP id smtpd.web11.31624.1710067320516234992 for ; Sun, 10 Mar 2024 03:42:00 -0700 X-Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d21cdbc85bso50711371fa.2 for ; Sun, 10 Mar 2024 03:42:00 -0700 (PDT) X-Gm-Message-State: LtrnP1YBx3gG1yGQfIfNWfxJx7686176AA= X-Google-Smtp-Source: AGHT+IEDJO9Ygy7801tu280i36tXoA0X23Jb3ryxf6wwhm9ByVrAIlR76X9IpV1XKl2y2IAH8xls7w== X-Received: by 2002:a2e:9e8a:0:b0:2d2:346a:f199 with SMTP id f10-20020a2e9e8a000000b002d2346af199mr2297739ljk.47.1710067318540; Sun, 10 Mar 2024 03:41:58 -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.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 10 Mar 2024 03:41:58 -0700 (PDT) From: "Mike Maslenkin" 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 Date: Sun, 10 Mar 2024 03:42:00 -0700 Message-Id: <20240310104151.41355-5-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=CXHE6Wgm; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) The structure instance retunred by ToStructure() must be deallocated properly. 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(-) diff --git a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComputerSys= tem/v1_5_0/RedfishResourceIdentifyLibComputerSystem.c b/RedfishClientPkg/Li= brary/RedfishResourceIdentifyLibComputerSystem/v1_5_0/RedfishResourceIdenti= fyLibComputerSystem.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;=0D =0D if (IS_EMPTY_STRING (ComputerSystemCs->UUID)) {=0D - return FALSE;=0D + Status =3D EFI_NOT_FOUND;=0D + goto ON_RELEASE;=0D }=0D =0D Status =3D AsciiStrToGuid (ComputerSystemCs->UUID, &ResourceUuid);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, fail to get resource UUID: %r\n", __func__, = Status));=0D - return FALSE;=0D + goto ON_RELEASE;=0D }=0D =0D Status =3D NetLibGetSystemGuid (&SystemUuid);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, fail to get system UUID from SMBIOS: %r\n", = __func__, Status));=0D - return FALSE;=0D + goto ON_RELEASE;=0D }=0D =0D DEBUG ((REDFISH_DEBUG_TRACE, "%a, Identify: System: %g Resource: %g\n", = __func__, &SystemUuid, &ResourceUuid));=0D @@ -92,6 +93,8 @@ RedfishIdentifyResource ( Status =3D EFI_UNSUPPORTED;=0D }=0D =0D +ON_RELEASE:=0D +=0D mJsonStructProtocol->DestoryStructure (=0D mJsonStructProtocol,=0D (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem= =0D --=20 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116568): https://edk2.groups.io/g/devel/message/116568 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] -=-=-=-=-=-=-=-=-=-=-=-