aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris D. Faulhaber <jedgar@FreeBSD.org>2002-02-23 00:15:50 +0000
committerChris D. Faulhaber <jedgar@FreeBSD.org>2002-02-23 00:15:50 +0000
commit1d746ad0b6840632bae7d4007276ba200a0b6186 (patch)
tree68b4cbf0a7f98ba6b713ab23dfa961bfcfe03147
parentb3ea8abeca50df2e24167770d1e7484f1f877a7d (diff)
downloadsrc-1d746ad0b6840632bae7d4007276ba200a0b6186.tar.gz
src-1d746ad0b6840632bae7d4007276ba200a0b6186.zip
MFC 1.3: Error handling fixes for inflate.
Notes
Notes: svn path=/releng/4.4/; revision=91091
-rw-r--r--lib/libz/infblock.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libz/infblock.c b/lib/libz/infblock.c
index f4920faa5ea0..6b2b5629e9e0 100644
--- a/lib/libz/infblock.c
+++ b/lib/libz/infblock.c
@@ -1,6 +1,8 @@
/* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * $FreeBSD$
*/
#include "zutil.h"
@@ -249,10 +251,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 +316,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 +333,7 @@ int r;
}
s->sub.decode.codes = c;
}
+ ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE