From: Vishnu Sanal T <t.v.s10123@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, lasse.collin@tukaani.org,
Vishnu Sanal T <t.v.s10123@gmail.com>
Subject: [PATCH] fix: possible memory leak in unxz()
Date: Sun, 6 Oct 2024 12:55:43 +0530 [thread overview]
Message-ID: <20241006072542.66442-2-t.v.s10123@gmail.com> (raw)
Fixes possible memory leak in the function unxz() in
lib/decompress_unxz.c forgets to free the pointer 'in', when
the statement if (fill == NULL && flush == NULL) is true.
Signed-off-by: Vishnu Sanal T <t.v.s10123@gmail.com>
---
lib/decompress_unxz.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
index 32138bb8ef77..8d58207ca1db 100644
--- a/lib/decompress_unxz.c
+++ b/lib/decompress_unxz.c
@@ -343,13 +343,13 @@ STATIC int INIT unxz(unsigned char *in, long in_size,
}
} while (ret == XZ_OK);
- if (must_free_in)
- free(in);
-
if (flush != NULL)
free(b.out);
}
+ if (must_free_in)
+ free(in);
+
if (in_used != NULL)
*in_used += b.in_pos;
--
2.46.2
next reply other threads:[~2024-10-06 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-06 7:25 Vishnu Sanal T [this message]
2024-10-06 18:17 ` [PATCH] fix: possible memory leak in unxz() Lasse Collin
2024-10-08 1:50 ` Andrew Morton
2024-10-08 14:40 ` Lasse Collin
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:
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=20241006072542.66442-2-t.v.s10123@gmail.com \
--to=t.v.s10123@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=lasse.collin@tukaani.org \
--cc=linux-kernel@vger.kernel.org \
/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