diff options
author | Chris D. Faulhaber <jedgar@FreeBSD.org> | 2002-02-22 02:48:40 +0000 |
---|---|---|
committer | Chris D. Faulhaber <jedgar@FreeBSD.org> | 2002-02-22 02:48:40 +0000 |
commit | 58956199e07e78d46edfe099b4c8da5a6dad3ed4 (patch) | |
tree | 4f895aca5c2440b8282e996318a0d27bdbc5a5f4 /lib | |
parent | 428099ef506925b2e9dac72d27cbd0ea4bfa66c3 (diff) | |
download | src-58956199e07e78d46edfe099b4c8da5a6dad3ed4.tar.gz src-58956199e07e78d46edfe099b4c8da5a6dad3ed4.zip |
MFC 1.3: Error handling fixes for inflate, add $FreeBSD$
Notes
Notes:
svn path=/stable/4/; revision=91038
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libz/infblock.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libz/infblock.c b/lib/libz/infblock.c index f4920faa5ea0..f2cd3c96123d 100644 --- a/lib/libz/infblock.c +++ b/lib/libz/infblock.c @@ -3,6 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + #include "zutil.h" #include "infblock.h" #include "inftrees.h" @@ -249,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; @@ -313,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 } @@ -329,6 +334,7 @@ int r; } s->sub.decode.codes = c; } + ZFREE(z, s->sub.trees.blens); s->mode = CODES; case CODES: UPDATE |