summaryrefslogtreecommitdiffstats
path: root/lib/libz
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-01-18 21:48:35 +0000
committermillert <millert@openbsd.org>2002-01-18 21:48:35 +0000
commit7c27ac90d2f36f74957a65e12ae61304ed3ae19f (patch)
tree961a82193b6cf8498c861340f86349ffd4a3dd4b /lib/libz
parentMakers of ESCC2 is now Infineon (formerly Siemens) (diff)
downloadwireguard-openbsd-7c27ac90d2f36f74957a65e12ae61304ed3ae19f.tar.xz
wireguard-openbsd-7c27ac90d2f36f74957a65e12ae61304ed3ae19f.zip
Fix some zlib memory leaks, originally from Mark Adler
Diffstat (limited to 'lib/libz')
-rw-r--r--lib/libz/infblock.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libz/infblock.c b/lib/libz/infblock.c
index f4920faa5ea..a883a1878b9 100644
--- a/lib/libz/infblock.c
+++ b/lib/libz/infblock.c
@@ -249,10 +249,12 @@ int r;
&s->sub.trees.tb, s->hufts, z);
if (t != Z_OK)
{
- ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+ }
LEAVE
}
s->sub.trees.index = 0;
@@ -313,11 +315,13 @@ int r;
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z);
- ZFREE(z, s->sub.trees.blens);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+ }
r = t;
LEAVE
}
@@ -329,6 +333,7 @@ int r;
}
s->sub.decode.codes = c;
}
+ ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE