Fixed zero length allocation.

This commit is contained in:
Armin Novak 2015-09-01 11:57:22 +02:00
parent 6c288bd0f2
commit 08f61e60ca

View File

@ -1552,12 +1552,20 @@ skip_encoding_loop:
if (success && message->numTiles != maxNbTiles)
{
void* pmem = realloc((void*) message->tiles, sizeof(RFX_TILE*) * message->numTiles);
if (message->numTiles > 0)
{
void* pmem = realloc((void*) message->tiles, sizeof(RFX_TILE*) * message->numTiles);
if (pmem)
message->tiles = (RFX_TILE**) pmem;
if (pmem)
message->tiles = (RFX_TILE**) pmem;
else
success = FALSE;
}
else
{
free(message->tiles);
success = FALSE;
}
}
/* when using threads ensure all computations are done */