Commit 171af59d authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/matroskadec: Cleanup error handling for bz2 & zlib

Fixes CID703652
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 56abf351
......@@ -1282,15 +1282,13 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
newpktdata = av_realloc(pkt_data, pkt_size);
if (!newpktdata) {
inflateEnd(&zstream);
result = AVERROR(ENOMEM);
goto failed;
}
pkt_data = newpktdata;
zstream.avail_out = pkt_size - zstream.total_out;
zstream.next_out = pkt_data + zstream.total_out;
if (pkt_data) {
result = inflate(&zstream, Z_NO_FLUSH);
} else
result = Z_MEM_ERROR;
} while (result == Z_OK && pkt_size < 10000000);
pkt_size = zstream.total_out;
inflateEnd(&zstream);
......@@ -1317,15 +1315,13 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
newpktdata = av_realloc(pkt_data, pkt_size);
if (!newpktdata) {
BZ2_bzDecompressEnd(&bzstream);
result = AVERROR(ENOMEM);
goto failed;
}
pkt_data = newpktdata;
bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
bzstream.next_out = pkt_data + bzstream.total_out_lo32;
if (pkt_data) {
result = BZ2_bzDecompress(&bzstream);
} else
result = BZ_MEM_ERROR;
} while (result == BZ_OK && pkt_size < 10000000);
pkt_size = bzstream.total_out_lo32;
BZ2_bzDecompressEnd(&bzstream);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment