mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Static Code Analysis: code potential memory leaks in inflate.c used by the setup.
This commit is contained in:
@@ -849,7 +849,10 @@ static int inflate_dynamic(__G)
|
|||||||
j = 3 + ((unsigned)b & 3);
|
j = 3 + ((unsigned)b & 3);
|
||||||
DUMPBITS(2)
|
DUMPBITS(2)
|
||||||
if ((unsigned)i + j > n)
|
if ((unsigned)i + j > n)
|
||||||
|
{
|
||||||
|
huft_free(tl);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
while (j--)
|
while (j--)
|
||||||
ll[i++] = l;
|
ll[i++] = l;
|
||||||
}
|
}
|
||||||
@@ -859,7 +862,10 @@ static int inflate_dynamic(__G)
|
|||||||
j = 3 + ((unsigned)b & 7);
|
j = 3 + ((unsigned)b & 7);
|
||||||
DUMPBITS(3)
|
DUMPBITS(3)
|
||||||
if ((unsigned)i + j > n)
|
if ((unsigned)i + j > n)
|
||||||
|
{
|
||||||
|
huft_free(tl);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
while (j--)
|
while (j--)
|
||||||
ll[i++] = 0;
|
ll[i++] = 0;
|
||||||
l = 0;
|
l = 0;
|
||||||
@@ -870,7 +876,10 @@ static int inflate_dynamic(__G)
|
|||||||
j = 11 + ((unsigned)b & 0x7f);
|
j = 11 + ((unsigned)b & 0x7f);
|
||||||
DUMPBITS(7)
|
DUMPBITS(7)
|
||||||
if ((unsigned)i + j > n)
|
if ((unsigned)i + j > n)
|
||||||
|
{
|
||||||
|
huft_free(tl);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
while (j--)
|
while (j--)
|
||||||
ll[i++] = 0;
|
ll[i++] = 0;
|
||||||
l = 0;
|
l = 0;
|
||||||
@@ -908,6 +917,7 @@ static int inflate_dynamic(__G)
|
|||||||
//if (!uO.qflag)
|
//if (!uO.qflag)
|
||||||
MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1);
|
MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1);
|
||||||
huft_free(tl);
|
huft_free(tl);
|
||||||
|
huft_free(td);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (i == 1) {
|
if (i == 1) {
|
||||||
@@ -917,6 +927,7 @@ static int inflate_dynamic(__G)
|
|||||||
//if (!uO.qflag)
|
//if (!uO.qflag)
|
||||||
MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1);
|
MESSAGE((uch *)"(incomplete d-tree) ", 21L, 1);
|
||||||
huft_free(td);
|
huft_free(td);
|
||||||
|
td = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (i)
|
if (i)
|
||||||
@@ -927,13 +938,15 @@ static int inflate_dynamic(__G)
|
|||||||
|
|
||||||
|
|
||||||
/* decompress until an end-of-block code */
|
/* decompress until an end-of-block code */
|
||||||
if (inflate_codes(__G__ tl, td, bl, bd))
|
i = inflate_codes(__G__ tl, td, bl, bd);
|
||||||
return 1;
|
|
||||||
|
|
||||||
|
|
||||||
/* free the decoding tables, return */
|
/* free the decoding tables, return */
|
||||||
huft_free(tl);
|
huft_free(tl);
|
||||||
huft_free(td);
|
huft_free(td);
|
||||||
|
|
||||||
|
if (i)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user