[FFmpeg-cvslog] avformat/matroskadec: Cleanup error handling for bz2 & zlib

Michael Niedermayer git at videolan.org
Tue Jun 2 00:50:08 CEST 2015


ffmpeg | branch: release/2.4 | Michael Niedermayer <michaelni at gmx.at> | Tue May 12 18:32:12 2015 +0200| [3bd85e1f834dff4a12afea3d9debc4f42148b825] | committer: Michael Niedermayer

avformat/matroskadec: Cleanup error handling for bz2 & zlib

Fixes CID703652

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 171af59d58fc67d82dce8ff7ed11fa671108baa5)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3bd85e1f834dff4a12afea3d9debc4f42148b825
---

 libavformat/matroskadec.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 83f3046..699c272 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1216,15 +1216,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);
@@ -1251,15 +1249,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);



More information about the ffmpeg-cvslog mailing list