summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-02-05 13:52:01 +0100
committerraysan5 <[email protected]>2021-02-05 13:52:01 +0100
commit4407533a41f5b46fd9939d93e6cc711aa08b083a (patch)
tree762d0d255027f82bdb812021cb697edc22eef480 /src/core.c
parent3431d5858611217e14b5422670cd7ddbdc4d3d8f (diff)
downloadraylib-4407533a41f5b46fd9939d93e6cc711aa08b083a.tar.gz
raylib-4407533a41f5b46fd9939d93e6cc711aa08b083a.zip
REVIEWED: DecompressData(), memory reallocation
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index 6b3906e7..4734fe5b 100644
--- a/src/core.c
+++ b/src/core.c
@@ -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);