diff options
author | Hristo Venev <hristo@venev.name> | 2020-06-09 13:17:02 +0000 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2020-06-09 13:19:12 +0000 |
commit | b2c4649aaa54ce40e8556b70e812132233f832b7 (patch) | |
tree | f095d264a749a7c6376516fcbefedc3322c69bc2 | |
parent | 586990981a2cf0b4522451178ac0882967811149 (diff) |
Fix double free when compressing empty files.
-rw-r--r-- | compress.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -29,7 +29,8 @@ static ssize_t read_data(FILE *in, uint8_t **pdata) { if(ferror_unlocked(in)) goto fail; uint8_t *r = realloc(data, len); - if(r) data = r; + if(len && !r) goto fail; + data = r; *pdata = data; return len; |