public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Memory leak in bfd_init_section_compress_status
@ 2023-02-08 23:13 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-02-08 23:13 UTC (permalink / raw)
  To: binutils

	* compress.c (bfd_init_section_compress_status): Free
	uncompressed_buffer on error return.

diff --git a/bfd/compress.c b/bfd/compress.c
index 2cf8a6c28c9..2a402c3f65c 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -1083,7 +1083,10 @@ bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
 
   if (!bfd_get_section_contents (abfd, sec, uncompressed_buffer,
 				 0, uncompressed_size))
-    return false;
+    {
+      free (uncompressed_buffer);
+      return false;
+    }
 
   sec->contents = uncompressed_buffer;
   if (bfd_compress_section_contents (abfd, sec) == 0)

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-08 23:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 23:13 Memory leak in bfd_init_section_compress_status Alan Modra

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).