changeset 32225:8ebdc8466b2f

Check for realloc failure. Ignore the memleak this causes since the mkv demuxer is not properly maintained anymore anyway.
author reimar
date Sat, 18 Sep 2010 17:40:14 +0000
parents 23ba595c0292
children 808e9d7eef5d
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Sat Sep 18 17:38:23 2010 +0000
+++ b/libmpdemux/demux_mkv.c	Sat Sep 18 17:40:14 2010 +0000
@@ -323,6 +323,8 @@
 
                 *size += 4000;
                 *dest = realloc(*dest, *size + AV_LZO_INPUT_PADDING);
+                if (!*dest)
+                    goto zlib_fail;
                 zstream.next_out = (Bytef *) (*dest + zstream.total_out);
                 result = inflate(&zstream, Z_NO_FLUSH);
                 if (result != Z_OK && result != Z_STREAM_END) {
@@ -356,6 +358,8 @@
                 if (dstlen > SIZE_MAX - padding)
                     goto lzo_fail;
                 *dest = realloc(*dest, dstlen + padding);
+                if (!*dest)
+                    goto lzo_fail;
                 out_avail = dstlen;
                 result = av_lzo1x_decode(*dest, &out_avail, src, &srclen);
                 if (result == 0)