summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Gallagher <john@gllghr.com>2023-04-27 23:04:31 -0700
committerMark Wielaard <mark@klomp.org>2023-05-08 17:46:00 +0200
commitfa7da8bfad1ec2ac61859aa0b4b09b42ea657ea2 (patch)
tree278210ba21efc583f55c2a3b84dc4926bac5e3e5
parentcded466a74d06fe1dff047b33e630f8a6aa721e1 (diff)
downloadelfutils-fa7da8bfad1ec2ac61859aa0b4b09b42ea657ea2.tar.gz
libdwfl: Fix memory leak in unzip()
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 <john@gllghr.com>
-rw-r--r--libdwfl/ChangeLog4
-rw-r--r--libdwfl/gzip.c2
2 files changed, 5 insertions, 1 deletions
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 <john@gllghr.com>
+
+ * gzip.c: Fix memory leak in unzip()
+
2023-02-06 Mark Wielaard <mark@klomp.org>
* 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,
#endif
)
/* 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