REVIEWED: DecompressData(), memory reallocation

This commit is contained in:
raysan5 2021-02-05 13:52:01 +01:00
parent 3431d58586
commit 4407533a41
2 changed files with 6 additions and 2 deletions

View File

@ -2602,7 +2602,11 @@ unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *
// Decompress data from a valid DEFLATE stream
data = RL_CALLOC(MAX_DECOMPRESSION_SIZE*1024*1024, 1);
int length = sinflate(data, compData, compDataLength);
RL_REALLOC(data, length);
unsigned char *temp = RL_REALLOC(data, length);
if (temp != NULL) data = temp;
else TRACELOG(LOG_WARNING, "SYSTEM: Failed to re-allocate required decompression memory");
*dataLength = length;
TraceLog(LOG_INFO, "SYSTEM: Data compressed: Original size: %i -> Comp. size: %i\n", dataLength, compDataLength);

View File

@ -4800,7 +4800,7 @@ static int GenerateMipmaps(unsigned char *data, int baseWidth, int baseHeight)
unsigned char *temp = RL_REALLOC(data, size);
if (temp != NULL) data = temp;
else TRACELOG(LOG_WARNING, "TEXTURE: Failed to allocate required mipmaps memory");
else TRACELOG(LOG_WARNING, "TEXTURE: Failed to re-allocate required mipmaps memory");
width = baseWidth;
height = baseHeight;