Further s_buf dealloc fixes on failed decompression.

This commit is contained in:
Con Kolivas 2018-05-16 14:35:06 +10:00
parent dc57230636
commit a94aeb7503

View file

@ -483,7 +483,6 @@ static int bzip2_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_
bzerr = BZ2_bzBuffToBuffDecompress((char*)ucthread->s_buf, &dlen, (char*)c_buf, ucthread->c_len, 0, 0); bzerr = BZ2_bzBuffToBuffDecompress((char*)ucthread->s_buf, &dlen, (char*)c_buf, ucthread->c_len, 0, 0);
if (unlikely(bzerr != BZ_OK)) { if (unlikely(bzerr != BZ_OK)) {
print_err("Failed to decompress buffer - bzerr=%d\n", bzerr); print_err("Failed to decompress buffer - bzerr=%d\n", bzerr);
ucthread->s_buf = c_buf;
ret = -1; ret = -1;
goto out; goto out;
} }
@ -518,7 +517,6 @@ static int gzip_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_t
gzerr = uncompress(ucthread->s_buf, &dlen, c_buf, ucthread->c_len); gzerr = uncompress(ucthread->s_buf, &dlen, c_buf, ucthread->c_len);
if (unlikely(gzerr != Z_OK)) { if (unlikely(gzerr != Z_OK)) {
print_err("Failed to decompress buffer - gzerr=%d\n", gzerr); print_err("Failed to decompress buffer - gzerr=%d\n", gzerr);
ucthread->s_buf = c_buf;
ret = -1; ret = -1;
goto out; goto out;
} }
@ -556,7 +554,6 @@ static int lzma_decompress_buf(rzip_control *control, struct uncomp_thread *ucth
lzmaerr = LzmaUncompress(ucthread->s_buf, &dlen, c_buf, &c_len, control->lzma_properties, 5); lzmaerr = LzmaUncompress(ucthread->s_buf, &dlen, c_buf, &c_len, control->lzma_properties, 5);
if (unlikely(lzmaerr)) { if (unlikely(lzmaerr)) {
print_err("Failed to decompress buffer - lzmaerr=%d\n", lzmaerr); print_err("Failed to decompress buffer - lzmaerr=%d\n", lzmaerr);
ucthread->s_buf = c_buf;
ret = -1; ret = -1;
goto out; goto out;
} }
@ -592,7 +589,6 @@ static int lzo_decompress_buf(rzip_control *control __UNUSED__, struct uncomp_th
if (unlikely(lzerr != LZO_E_OK)) { if (unlikely(lzerr != LZO_E_OK)) {
print_err("Failed to decompress buffer - lzerr=%d\n", lzerr); print_err("Failed to decompress buffer - lzerr=%d\n", lzerr);
dealloc(ucthread->s_buf); dealloc(ucthread->s_buf);
ucthread->s_buf = c_buf;
ret = -1; ret = -1;
goto out; goto out;
} }