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

29 lines
722 B
Diff

From 934225e46aefd31178f91566fa2878650ad0e544 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 67f2158..a96e099 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