From nobody Mon Feb 9 19:06:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+110149+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+110149+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1698364443; cv=none; d=zohomail.com; s=zohoarc; b=mgPuk9XQiUo3decJuy/bX3ouCiG4IP8KItK7+ruvT2u+GwjBolRblNFf/4nhFMX3L1OjZBcxDbinktaTMNBeG6X/ddvkZl48nFYfIE/FHZfdvBBXjKMIkxtIl4nwBHHvstbOPsJZADhntVqCruKiVtgNxmKfpmf8IL5yWZEt7hE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1698364443; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=RAnGXpiAzqrcUuCrhVO2qSk1BY9m33Lb05HWQgWVPT4=; b=ZHMEAyC81GyyddSnW92KvtRkZoIjrIhk0SpDLj4OWNtTgeTevqI1LvAxsJhIkUn7ZwkFQ6TWdz/hOsGlk2Qi5LOMzJpbrR72i8RWa2UgugD2qzXCt1+MXpMitVCEsWUBR8Ca1pLqk7b7O/5McedzSe7bV/dt/NvdAEaJ5r0U7ro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+110149+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1698364443515689.0091231170417; Thu, 26 Oct 2023 16:54:03 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=OpbBZ86m4TjfwfFa6orJp3tsUxZ6cUnEYTSEndVp4dg=; 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=20140610; t=1698364443; v=1; b=j4A3dsnmoii9WjRcclPZw9OYgfBtxClZln8WyXqSzBFTURRrevrIpnG9DnYQ0uJ6aWgKNUEO u39v5S2sv0N2EiSIljgcnunMEcWMIlISwlCrTWGShhD9uZaPznuTUupENmkHdy5W26wFdJixcw3 txFtuYKTpLuhKAFCWPTFlxlw= X-Received: by 127.0.0.2 with SMTP id yJZ4YY1788612x2xYsk10PZr; Thu, 26 Oct 2023 16:54:03 -0700 X-Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by mx.groups.io with SMTP id smtpd.web10.215565.1698364442410027940 for ; Thu, 26 Oct 2023 16:54:02 -0700 X-Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-507a62d4788so2355896e87.0 for ; Thu, 26 Oct 2023 16:54:02 -0700 (PDT) X-Gm-Message-State: RbmYkvrSWf36mn8gDtT4qlmJx1787277AA= X-Google-Smtp-Source: AGHT+IHg9RmaI4B+Ym+pefQZT/YgF3rnH3uO/ZAl2+HiY5yLU+CV5/eLydIvywEpfV50RnlVP4oBtA== X-Received: by 2002:ac2:5a02:0:b0:504:31a0:f9e2 with SMTP id q2-20020ac25a02000000b0050431a0f9e2mr574156lfn.58.1698364440277; Thu, 26 Oct 2023 16:54:00 -0700 (PDT) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id u8-20020a056512040800b00507a8789b43sm39389lfk.269.2023.10.26.16.53.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 26 Oct 2023 16:53:59 -0700 (PDT) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com, Mike Maslenkin Subject: [edk2-devel] [edk2-redfish-client][PATCH v2 04/11] RedfishClientPkg: RedfishFeatureUtilityLib: fix memory leaks Date: Fri, 27 Oct 2023 02:53:47 +0300 Message-Id: <20231026235354.67625-5-mike.maslenkin@gmail.com> In-Reply-To: <20231026235354.67625-1-mike.maslenkin@gmail.com> References: <20231026235354.67625-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-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1698364445685100022 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mike Maslenkin --- .../RedfishFeatureUtilityLib.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishF= eatureUtilityLib.c index 35e342c817b7..8fa1dc2c3535 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c @@ -515,6 +515,7 @@ ApplyFeatureSettingsVagueType ( Status =3D UnicodeStrToAsciiStrS (ConfigureLang, ConfigureLangAscii, Str= Len (ConfigureLang) + 1); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, Convert the configureLang of vague key of %a= .%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status)); + FreePool (ConfigureLangAscii); return Status; } =20 @@ -1972,6 +1973,7 @@ RedfishGetUri ( // if (*Target =3D=3D '\0') { DEBUG ((DEBUG_ERROR, "%a, invalid format: %s\n", __func__, ConfigLan= g)); + FreePool (ResultStr); return NULL; } =20 @@ -1983,6 +1985,7 @@ RedfishGetUri ( TempStrSize =3D (ConfigLangLen - RemainingLen + 1) * sizeof (CHAR16); TempStr =3D AllocateCopyPool (TempStrSize, Head); if (TempStr =3D=3D NULL) { + FreePool (ResultStr); return NULL; } =20 @@ -1996,6 +1999,8 @@ RedfishGetUri ( ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, Can not find: %s\n", __func__, TempStr)); + FreePool (ResultStr); + FreePool (TempStr); return NULL; } =20 @@ -2102,10 +2107,14 @@ GetConfigureLang ( =20 Status =3D AsciiStrToUnicodeStrS (Uri, UnicodeUri, StringSize); if (EFI_ERROR (Status)) { + FreePool (UnicodeUri); return NULL; } =20 ConfigLang =3D RedfishGetConfigLanguage (UnicodeUri); + + FreePool (UnicodeUri); + if (ConfigLang =3D=3D NULL) { return NULL; } @@ -2117,11 +2126,14 @@ GetConfigureLang ( StringSize =3D StrSize (ConfigLang) + ((AsciiStrLen (PropertyName) + 1) = * sizeof (CHAR16)); ResultStr =3D AllocatePool (StringSize); if (ResultStr =3D=3D NULL) { + FreePool (ConfigLang); return NULL; } =20 UnicodeSPrint (ResultStr, StringSize, L"%s/%a", ConfigLang, PropertyName= ); =20 + FreePool (ConfigLang); + return ResultStr; } =20 @@ -2296,9 +2308,12 @@ GetPropertyStringValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status)); + FreePool (ConfigureLangBuffer); return NULL; } =20 + FreePool (ConfigureLangBuffer); + if (RedfishValue.Type !=3D RedfishValueTypeString) { DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n", __func= __, Schema, Version, ConfigureLang)); return NULL; @@ -2354,9 +2369,12 @@ GetPropertyNumericValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status)); + FreePool (ConfigureLangBuffer); return NULL; } =20 + FreePool (ConfigureLangBuffer); + if (RedfishValue.Type !=3D RedfishValueTypeInteger) { DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n", __fun= c__, Schema, Version, ConfigureLang)); return NULL; @@ -2416,9 +2434,12 @@ GetPropertyBooleanValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status)); + FreePool (ConfigureLangBuffer); return NULL; } =20 + FreePool (ConfigureLangBuffer); + if (RedfishValue.Type !=3D RedfishValueTypeBoolean) { DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n", __fun= c__, Schema, Version, ConfigureLang)); return NULL; @@ -2517,9 +2538,12 @@ GetPropertyStringArrayValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status)); + FreePool (ConfigureLangBuffer); return NULL; } =20 + FreePool (ConfigureLangBuffer); + if (RedfishValue.Type !=3D RedfishValueTypeStringArray) { DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", = __func__, Schema, Version, ConfigureLang)); return NULL; @@ -2588,9 +2612,12 @@ GetPropertyNumericArrayValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status)); + FreePool (ConfigureLangBuffer); return NULL; } =20 + FreePool (ConfigureLangBuffer); + if (RedfishValue.Type !=3D RedfishValueTypeIntegerArray) { DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", = __func__, Schema, Version, ConfigureLang)); return NULL; @@ -2659,9 +2686,12 @@ GetPropertyBooleanArrayValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status)); + FreePool (ConfigureLangBuffer); return NULL; } =20 + FreePool (ConfigureLangBuffer); + if (RedfishValue.Type !=3D RedfishValueTypeBooleanArray) { DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", = __func__, Schema, Version, ConfigureLang)); return NULL; --=20 2.32.0 (Apple Git-132) -=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 (#110149): https://edk2.groups.io/g/devel/message/110149 Mute This Topic: https://groups.io/mt/102211773/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-