public inbox for
 help / color / mirror / Atom feed
From: John Gallagher <>
Subject: [PATCH] libdwfl: Fix memory leak in unzip()
Date: Thu, 27 Apr 2023 23:04:31 -0700	[thread overview]
Message-ID: <ZEth7/K1GwOAAMS/@localhost.localdomain> (raw)

state.input_buffer is not freed if the file is found to not be
compressed with the compression algorithm unzip() is trying to use.

Signed-off-by: John Gallagher <>
 libdwfl/ChangeLog | 4 ++++
 libdwfl/gzip.c    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index daef2828..54d85921 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,7 @@
+2023-04-24  John Gallagher  <>
+	* gzip.c: Fix memory leak in unzip()
 2023-02-06  Mark Wielaard  <>
 	* libdwfl.h: Guard debuginfod_client typedef with
diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c
index 53013be3..002afc4e 100644
--- a/libdwfl/gzip.c
+++ b/libdwfl/gzip.c
@@ -227,7 +227,7 @@ unzip (int fd, off_t start_offset,
     /* Not a compressed file.  */
-    return DWFL_E_BADELF;
+    return fail (&state, DWFL_E_BADELF);
 #ifdef ZSTD
   /* special case for libzstd since it is slightly different from the

             reply	other threads:[~2023-04-28  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28  6:04 John Gallagher [this message]
2023-05-08 16:12 ` Mark Wielaard

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-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

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

  git send-email \
    --in-reply-to=ZEth7/K1GwOAAMS/@localhost.localdomain \ \ \

* 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).