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
commitd921867039c986299a160ce51d8a6661670b3551 (patch)
tree5ef7209fda0d1f4ab7abbee87c030d25d8eda670
parent2012d213f7a837f8fd3b185be947b9def0fe9c34 (diff)
downloadsrc-d921867039c986299a160ce51d8a6661670b3551.tar.gz
src-d921867039c986299a160ce51d8a6661670b3551.zip
MFC 1.3: Error handling fixes for inflate.
Notes
Notes: svn path=/releng/4.3/; 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