1diff -up inflate.c.pom inflate.c
2--- inflate.c.pom	2005-02-27 07:08:46.000000000 +0100
3+++ inflate.c	2008-03-19 14:47:58.000000000 +0100
4@@ -983,6 +983,7 @@ static int inflate_dynamic(__G)
5   unsigned l;           /* last length */
6   unsigned m;           /* mask for bit lengths table */
7   unsigned n;           /* number of lengths to get */
8+  struct huft *tlp;
9   struct huft *tl;      /* literal/length code table */
10   struct huft *td;      /* distance code table */
11   unsigned bl;          /* lookup bits for tl */
12@@ -995,6 +996,7 @@ static int inflate_dynamic(__G)
13   register unsigned k;  /* number of bits in bit buffer */
14   int retval = 0;       /* error code returned: initialized to "no error" */
15 
16+  td = tlp = tl = (struct huft *)NULL;
17 
18   /* make local bit buffer */
19   Trace((stderr, "\ndynamic block"));
20@@ -1047,9 +1049,9 @@ static int inflate_dynamic(__G)
21   while (i < n)
22   {
23     NEEDBITS(bl)
24-    j = (td = tl + ((unsigned)b & m))->b;
25+    j = (tlp = tl + ((unsigned)b & m))->b;
26     DUMPBITS(j)
27-    j = td->v.n;
28+    j = tlp->v.n;
29     if (j < 16)                 /* length of code in bits (0..15) */
30       ll[i++] = l = j;          /* save last length in l */
31     else if (j == 16)           /* repeat last length 3 to 6 times */
32@@ -1149,8 +1151,8 @@ static int inflate_dynamic(__G)
33 
34 cleanup_and_exit:
35   /* free the decoding tables, return */
36-  huft_free(tl);
37-  huft_free(td);
38+  if (tl) huft_free(tl);
39+  if (td) huft_free(td);
40   return retval;
41 }
42 
43