public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Eric Dong <eric.dong@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [patch 2/2] BaseTool/VfrCompile: Fix potential memory leak issue
Date: Tue, 27 Feb 2018 13:53:47 +0800	[thread overview]
Message-ID: <1519710827-11228-2-git-send-email-dandan.bi@intel.com> (raw)
In-Reply-To: <1519710827-11228-1-git-send-email-dandan.bi@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=771

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 9bdc544..5cab7bb 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3502,10 +3502,14 @@ CVfrStringDB::SetStringFileName(IN CHAR8 *StringFileName)
 
   if (StringFileName == NULL) {
     return;
   }
 
+  if (mStringFileName != NULL) {
+    delete[] mStringFileName;
+  }
+
   FileLen = strlen (StringFileName) + 1;
   mStringFileName = new CHAR8[FileLen];
   if (mStringFileName == NULL) {
     return;
   }
-- 
1.9.5.msysgit.1



  reply	other threads:[~2018-02-27  5:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27  5:53 [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[] Dandan Bi
2018-02-27  5:53 ` Dandan Bi [this message]
2018-03-23  6:56   ` [patch 2/2] BaseTool/VfrCompile: Fix potential memory leak issue Gao, Liming
2018-03-23  6:56 ` [patch 1/2] BaseTool/VfrCompile: make delete[] match with new[] Gao, Liming

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=1519710827-11228-2-git-send-email-dandan.bi@intel.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