summaryrefslogtreecommitdiffstats
path: root/sys/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 /sys/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 'sys/lib/libz')
-rw-r--r--sys/lib/libz/infblock.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/lib/libz/infblock.c b/sys/lib/libz/infblock.c
index d3d3bb8e347..df9eb431f51 100644
--- a/sys/lib/libz/infblock.c
+++ b/sys/lib/libz/infblock.c
@@ -246,10 +246,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;
@@ -310,11 +312,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
}
@@ -326,6 +330,7 @@ int r;
}
s->sub.decode.codes = c;
}
+ ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE