public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: devel@edk2.groups.io
Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com,
	Mike Maslenkin <mike.maslenkin@gmail.com>
Subject: [edk2-devel] [PATCH v2 4/6] RedfishClientPkg: fix memory leak during EFI variables write.
Date: Tue, 29 Aug 2023 11:01:10 +0300	[thread overview]
Message-ID: <20230829080112.12748-5-mike.maslenkin@gmail.com> (raw)
In-Reply-To: <20230829080112.12748-1-mike.maslenkin@gmail.com>

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c       | 6 +++++-
 RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c            | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
index 86684cc72e1e..6a72afed8715 100644
--- a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
+++ b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
@@ -424,7 +424,11 @@ SaveConfigLangMapList (
     gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, 0, NULL);
   }
 
-  return gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData);
+  Status = gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData);
+
+  FreePool (VarData);
+
+  return Status;
 }
 
 /**
diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
index 7ac6e885dea6..a892ced984c8 100644
--- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
+++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
@@ -411,7 +411,11 @@ SaveETagList (
     gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, 0, NULL);
   }
 
-  return gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData);
+  Status = gRT->SetVariable (VariableName, &gEfiRedfishClientVariableGuid, VARIABLE_ATTRIBUTE_NV_BS, VarSize, (VOID *)VarData);
+
+  FreePool (VarData);
+
+  return Status;
 }
 
 /**
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108082): https://edk2.groups.io/g/devel/message/108082
Mute This Topic: https://groups.io/mt/101027006/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-08-29  8:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29  8:01 [edk2-devel] [PATCH v2 0/6] RedfishClientPkg: fix issues with local variables Mike Maslenkin
2023-08-29  8:01 ` [edk2-devel] [PATCH v2 1/6] RedfishClientPkg: fix crash on access to uninialized list variable Mike Maslenkin
2023-08-30  1:47   ` Nickle Wang via groups.io
2023-08-31  3:28     ` Chang, Abner via groups.io
2023-08-29  8:01 ` [edk2-devel] [PATCH v2 2/6] RedfishClientPkg: fix access to uninitialized variable Mike Maslenkin
2023-08-30  1:48   ` Nickle Wang via groups.io
2023-08-29  8:01 ` [edk2-devel] [PATCH v2 3/6] RedfishClientPkg: fix leak of allocated Etag data Mike Maslenkin
2023-08-30  1:49   ` Nickle Wang via groups.io
2023-08-29  8:01 ` Mike Maslenkin [this message]
2023-08-30  1:49   ` [edk2-devel] [PATCH v2 4/6] RedfishClientPkg: fix memory leak during EFI variables write Nickle Wang via groups.io
2023-08-29  8:01 ` [edk2-devel] [PATCH v2 5/6] RedfishClientPkg: fix misprints in Readme.md Mike Maslenkin
2023-08-30  1:51   ` Nickle Wang via groups.io
2023-08-29  8:01 ` [edk2-devel] [PATCH v2 6/6] RedfishClientPkg: spelling fixes Mike Maslenkin
2023-08-30  1:52   ` Nickle Wang via groups.io
2023-08-30 15:30   ` Igor Kulchytskyy via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230829080112.12748-5-mike.maslenkin@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox