diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-29 12:26:45 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-29 12:26:45 -0400 |
commit | c8346c0bf99aaef85757bae09311661d06d801c4 (patch) | |
tree | 7c32be6879465b259cdfa92acfd5953a8f82c74c /tools/lz/uncomp.c | |
parent | 416255bea47756eefb365f32c996100d5c88c9c3 (diff) | |
parent | 9dbe676f445210aaaa6eedcd805cbb65318ac77f (diff) |
Merge branch 'master' of https://github.com/pret/pokegold
Diffstat (limited to 'tools/lz/uncomp.c')
-rw-r--r-- | tools/lz/uncomp.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } |