From 9cc19e2aaad6a408571bde1182fa2ce368108894 Mon Sep 17 00:00:00 2001 From: jedgar Date: Sun, 17 Feb 2002 17:35:18 +0000 Subject: Error handling fixes for inflate. --- lib/libz/infblock.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/libz/infblock.c b/lib/libz/infblock.c index c46858c..f2cd3c9 100644 --- a/lib/libz/infblock.c +++ b/lib/libz/infblock.c @@ -252,10 +252,11 @@ 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) + if (r == Z_DATA_ERROR) { + ZFREE(z, s->sub.trees.blens); s->mode = BAD; + } LEAVE } s->sub.trees.index = 0; @@ -316,11 +317,12 @@ 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) + if (t == (uInt)Z_DATA_ERROR) { + ZFREE(z, s->sub.trees.blens); s->mode = BAD; + } r = t; LEAVE } @@ -332,6 +334,7 @@ int r; } s->sub.decode.codes = c; } + ZFREE(z, s->sub.trees.blens); s->mode = CODES; case CODES: UPDATE -- cgit v1.1