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 21425740038 for ; Fri, 29 Sep 2023 21:59:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1wGWGka2sqfvo0PNeyC4sA3OStgPvpBbVfujY927MK4=; 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=1696024765; v=1; b=HAZmm3qJFkfMznZR0PkNXwuxP0M8GYOzsgeuPr1HN7cGq9IiGwzupda94C0C3cD1lILClflN S1UBfUztc5d0xliw/VdnwKLsHAtsXL1QybMwPq6JvVfoFVKoKNuStgcdKwH6hZt3Z+2lZOjNrwS of0xdlPoXq64Khx5pCidebPo= X-Received: by 127.0.0.2 with SMTP id HgrJYY7687511xiPmp03VWZY; Fri, 29 Sep 2023 14:59:25 -0700 X-Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by mx.groups.io with SMTP id smtpd.web10.30358.1696024764648062168 for ; Fri, 29 Sep 2023 14:59:25 -0700 X-Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2c135cf2459so217796391fa.0 for ; Fri, 29 Sep 2023 14:59:24 -0700 (PDT) X-Gm-Message-State: c3JCgAeQClZsl5sua3QuSB2yx7686176AA= X-Google-Smtp-Source: AGHT+IE0RXCD+sb4eXMCxoNF/TkspElQ9WkUIowRxDq49tOECuS3f82TACDKE74+bE3UrQ/z/5x0Xw== X-Received: by 2002:a2e:a41a:0:b0:2c0:21b6:e80c with SMTP id p26-20020a2ea41a000000b002c021b6e80cmr5242466ljn.35.1696024762700; Fri, 29 Sep 2023 14:59:22 -0700 (PDT) X-Received: from localhost.localdomain ([185.9.78.108]) by smtp.gmail.com with ESMTPSA id y24-20020a2ebb98000000b002bfe8537f37sm890178lje.33.2023.09.29.14.59.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 29 Sep 2023 14:59:22 -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] [PATCH 4/9] RedfishClientPkg: RedfishFeatureUtilityLib: fix memory leaks Date: Sat, 30 Sep 2023 00:59:10 +0300 Message-Id: <20230929215915.46616-5-mike.maslenkin@gmail.com> In-Reply-To: <20230929215915.46616-1-mike.maslenkin@gmail.com> References: <20230929215915.46616-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=20140610 header.b=HAZmm3qJ; 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 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);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, Convert the configureLang of vague key of %a= .%a %s failed: %r\n", __func__, Schema, Version, ConfigureLang, Status));=0D + FreePool (ConfigureLangAscii);=0D return Status;=0D }=0D =0D @@ -1972,6 +1973,7 @@ RedfishGetUri ( //=0D if (*Target =3D=3D '\0') {=0D DEBUG ((DEBUG_ERROR, "%a, invalid format: %s\n", __func__, ConfigLan= g));=0D + FreePool (ResultStr);=0D return NULL;=0D }=0D =0D @@ -1983,6 +1985,7 @@ RedfishGetUri ( TempStrSize =3D (ConfigLangLen - RemainingLen + 1) * sizeof (CHAR16);= =0D TempStr =3D AllocateCopyPool (TempStrSize, Head);=0D if (TempStr =3D=3D NULL) {=0D + FreePool (ResultStr);=0D return NULL;=0D }=0D =0D @@ -1996,6 +1999,8 @@ RedfishGetUri ( );=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, Can not find: %s\n", __func__, TempStr));= =0D + FreePool (ResultStr);=0D + FreePool (TempStr);=0D return NULL;=0D }=0D =0D @@ -2102,10 +2107,14 @@ GetConfigureLang ( =0D Status =3D AsciiStrToUnicodeStrS (Uri, UnicodeUri, StringSize);=0D if (EFI_ERROR (Status)) {=0D + FreePool (UnicodeUri);=0D return NULL;=0D }=0D =0D ConfigLang =3D RedfishGetConfigLanguage (UnicodeUri);=0D +=0D + FreePool (UnicodeUri);=0D +=0D if (ConfigLang =3D=3D NULL) {=0D return NULL;=0D }=0D @@ -2117,11 +2126,14 @@ GetConfigureLang ( StringSize =3D StrSize (ConfigLang) + ((AsciiStrLen (PropertyName) + 1) = * sizeof (CHAR16));=0D ResultStr =3D AllocatePool (StringSize);=0D if (ResultStr =3D=3D NULL) {=0D + FreePool (ConfigLang);=0D return NULL;=0D }=0D =0D UnicodeSPrint (ResultStr, StringSize, L"%s/%a", ConfigLang, PropertyName= );=0D =0D + FreePool (ConfigLang);=0D +=0D return ResultStr;=0D }=0D =0D @@ -2296,9 +2308,12 @@ GetPropertyStringValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));=0D + FreePool (ConfigureLangBuffer);=0D return NULL;=0D }=0D =0D + FreePool (ConfigureLangBuffer);=0D +=0D if (RedfishValue.Type !=3D RedfishValueTypeString) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string type\n", __func= __, Schema, Version, ConfigureLang));=0D return NULL;=0D @@ -2354,9 +2369,12 @@ GetPropertyNumericValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));=0D + FreePool (ConfigureLangBuffer);=0D return NULL;=0D }=0D =0D + FreePool (ConfigureLangBuffer);=0D +=0D if (RedfishValue.Type !=3D RedfishValueTypeInteger) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not numeric type\n", __fun= c__, Schema, Version, ConfigureLang));=0D return NULL;=0D @@ -2416,9 +2434,12 @@ GetPropertyBooleanValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));=0D + FreePool (ConfigureLangBuffer);=0D return NULL;=0D }=0D =0D + FreePool (ConfigureLangBuffer);=0D +=0D if (RedfishValue.Type !=3D RedfishValueTypeBoolean) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not boolean type\n", __fun= c__, Schema, Version, ConfigureLang));=0D return NULL;=0D @@ -2517,9 +2538,12 @@ GetPropertyStringArrayValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));=0D + FreePool (ConfigureLangBuffer);=0D return NULL;=0D }=0D =0D + FreePool (ConfigureLangBuffer);=0D +=0D if (RedfishValue.Type !=3D RedfishValueTypeStringArray) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", = __func__, Schema, Version, ConfigureLang));=0D return NULL;=0D @@ -2588,9 +2612,12 @@ GetPropertyNumericArrayValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));=0D + FreePool (ConfigureLangBuffer);=0D return NULL;=0D }=0D =0D + FreePool (ConfigureLangBuffer);=0D +=0D if (RedfishValue.Type !=3D RedfishValueTypeIntegerArray) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", = __func__, Schema, Version, ConfigureLang));=0D return NULL;=0D @@ -2659,9 +2686,12 @@ GetPropertyBooleanArrayValue ( Status =3D RedfishPlatformConfigGetValue (Schema, Version, ConfigureLang= Buffer, &RedfishValue);=0D if (EFI_ERROR (Status)) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a query current setting for %s failed: %= r\n", __func__, Schema, Version, ConfigureLangBuffer, Status));=0D + FreePool (ConfigureLangBuffer);=0D return NULL;=0D }=0D =0D + FreePool (ConfigureLangBuffer);=0D +=0D if (RedfishValue.Type !=3D RedfishValueTypeBooleanArray) {=0D DEBUG ((DEBUG_ERROR, "%a, %a.%a %s value is not string array type\n", = __func__, Schema, Version, ConfigureLang));=0D return NULL;=0D --=20 2.32.0 (Apple Git-132) -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109220): https://edk2.groups.io/g/devel/message/109220 Mute This Topic: https://groups.io/mt/101667463/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-