VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-08 23:37:49 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-02-09 11:01:13 +0100
commit28a9eaf0e3e516e61e7a0585e6b7c9e7465bd342 (patch)
tree799789866ddb211f04a2f3f14dc38fae0850e88b
parentde0c30dded45ea9956a2e7b241ce16641b30492f (diff)
downloadVeraCrypt-28a9eaf0e3e516e61e7a0585e6b7c9e7465bd342.tar.gz
VeraCrypt-28a9eaf0e3e516e61e7a0585e6b7c9e7465bd342.zip
Static Code Analysis: code potential memory leaks in inflate.c used by the setup.
-rw-r--r--src/Common/Inflate.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Common/Inflate.c b/src/Common/Inflate.c
index d4c8908a..bf850e79 100644
--- a/src/Common/Inflate.c
+++ b/src/Common/Inflate.c
@@ -849,7 +849,10 @@ static int inflate_dynamic(__G)
j = 3 + ((unsigned)b & 3);
DUMPBITS(2)
if ((unsigned)i + j > n)
+ {
+ huft_free(tl);
return 1;
+ }
while (j--)
ll[i++] = l;
}
@@ -859,7 +862,10 @@ static int inflate_dynamic(__G)
j = 3 + ((unsigned)b & 7);
DUMPBITS(3)
if ((unsigned)i + j > n)
+ {
+ huft_free(tl);
return 1;
+ }
while (j--)
ll[i++] = 0;
l = 0;
@@ -870,7 +876,10 @@ static int inflate_dynamic(__G)
j = 11 + ((unsigned)b & 0x7f);
DUMPBITS(7)
if ((unsigned)i + j > n)
+ {
+ huft_free(tl);
return 1;
+ }
while (j--)
ll[i++] = 0;
l = 0;
@@ -908,6 +917,7 @@ static int inflate_dynamic(__G)
//if (!uO.qflag)
MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1);
huft_free(tl);
+ huft_free(td);
return 1;
}
if (i == 1) {
@@ -917,6 +927,7 @@ static int inflate_dynamic(__G)
//if (!uO.qflag)
MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1);
huft_free(td);
+ td = NULL;
#endif
}
if (i)
@@ -927,13 +938,15 @@ static int inflate_dynamic(__G)
/* decompress until an end-of-block code */
- if (inflate_codes(__G__ tl, td, bl, bd))
- return 1;
-
+ i = inflate_codes(__G__ tl, td, bl, bd);
/* free the decoding tables, return */
huft_free(tl);
huft_free(td);
+
+ if (i)
+ return 1;
+
return 0;
}