aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-12 18:32:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-21 20:43:38 +0200
commitb7a3a3a8d2845ba662d772b475812332be4b92cb (patch)
tree1959e2a3585c270e4cd01dd0f98fcdc794f557e3 /libavformat/matroskadec.c
parent2012a226d281de87e0466baed7d3da7d0fe3a1a0 (diff)
downloadffmpeg-b7a3a3a8d2845ba662d772b475812332be4b92cb.tar.gz
avformat/matroskadec: Cleanup error handling for bz2 & zlib
Fixes CID703652 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 171af59d58fc67d82dce8ff7ed11fa671108baa5) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8dc8428b77..0bfa9dc264 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1218,15 +1218,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;
+ result = inflate(&zstream, Z_NO_FLUSH);
} while (result == Z_OK && pkt_size < 10000000);
pkt_size = zstream.total_out;
inflateEnd(&zstream);
@@ -1253,15 +1251,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;
+ result = BZ2_bzDecompress(&bzstream);
} while (result == BZ_OK && pkt_size < 10000000);
pkt_size = bzstream.total_out_lo32;
BZ2_bzDecompressEnd(&bzstream);