From 4ac8bcc29a4ad5bb908b692baa040e7c7eb21249 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Thu, 28 May 2020 06:44:10 -0400 Subject: Checkpoint where things mostly work. --- tools/lz/uncomp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/lz/uncomp.c') diff --git a/tools/lz/uncomp.c b/tools/lz/uncomp.c index 3544cd93..b22fc75f 100644 --- a/tools/lz/uncomp.c +++ b/tools/lz/uncomp.c @@ -49,7 +49,7 @@ struct command * get_commands_from_file (const unsigned char * data, unsigned sh } if (slack) *slack = *size - (rp - data); *size = current - result; - return realloc(result, *size * sizeof(struct command)); + return realloc(result, (*size ? *size : 1) * sizeof(struct command)); error: free(result); return NULL; @@ -88,5 +88,5 @@ unsigned char * get_uncompressed_data (const struct command * commands, const un } } *size = current - result; - return result; + return realloc(result, *size ? *size : 1); } -- cgit v1.2.3