file/0003-Avoid-leak-in-zlib-clusterfuzz.patch
tangyuchen f7cf6d3673 file: fix a memory leak problem
Signed-off-by: tangyuchen <tangyuchen5@huawei.com>
(cherry picked from commit b1aa6f1e5f5181d15999ab12afe7336fb4efb318)
2024-04-09 15:21:03 +08:00

29 lines
722 B
Diff

From 54466c8b4cc07eaabaa2602bdf6b858bfe82e3d1 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 20 Sep 2022 21:11:00 +0000
Subject: [PATCH] Avoid leak in zlib (clusterfuzz)
---
src/compress.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/compress.c b/src/compress.c
index 9f65e4f..fb9b55e 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -578,8 +578,10 @@ uncompresszlib(const unsigned char *old, unsigned char **newch,
goto err;
rc = inflate(&z, Z_SYNC_FLUSH);
- if (rc != Z_OK && rc != Z_STREAM_END)
+ if (rc != Z_OK && rc != Z_STREAM_END) {
+ inflateEnd(&z);
goto err;
+ }
*n = CAST(size_t, z.total_out);
rc = inflateEnd(&z);
--
2.33.0