public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] unstrip: Fix small leak in handle_output_dir_module.
@ 2021-04-03 17:38 Mark Wielaard
  2021-04-13 12:45 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Wielaard @ 2021-04-03 17:38 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

eu-unstrip might leak a string for each module found when using the -d
option. Make sure to free the output_file name when we are done with the
module.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 src/ChangeLog | 4 ++++
 src/unstrip.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index f0eee7a8..300deb4f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-03  Mark Wielaard  <mark@klomp.org>
+
+	* unstrip.c (handle_output_dir_module): Free output_file when done.
+
 2021-04-03  Mark Wielaard  <mark@klomp.org>
 
 	* ar.c (do_oper_insert): Always close newfd.
diff --git a/src/unstrip.c b/src/unstrip.c
index f7742ebd..e488e810 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -2404,6 +2404,8 @@ handle_output_dir_module (const char *output_dir, Dwfl_Module *mod, bool force,
     error (EXIT_FAILURE, 0, _("memory exhausted"));
 
   handle_dwfl_module (output_file, true, force, mod, all, ignore, relocate);
+
+  free (output_file);
 }
 
 
-- 
2.18.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] unstrip: Fix small leak in handle_output_dir_module.
  2021-04-03 17:38 [PATCH] unstrip: Fix small leak in handle_output_dir_module Mark Wielaard
@ 2021-04-13 12:45 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2021-04-13 12:45 UTC (permalink / raw)
  To: elfutils-devel

On Sat, Apr 03, 2021 at 07:38:07PM +0200, Mark Wielaard wrote:
> eu-unstrip might leak a string for each module found when using the -d
> option. Make sure to free the output_file name when we are done with the
> module.

Pushed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-13 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-03 17:38 [PATCH] unstrip: Fix small leak in handle_output_dir_module Mark Wielaard
2021-04-13 12:45 ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).