aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-03-12 13:04:09 +0000
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-03-12 17:48:14 +0000
commit6bdae41d3ef74a0865e8f87896e649f93b2f39bd (patch)
tree2a82a1e039e4730ee704fe42be9d6e7322baf05e /libavformat/matroskadec.c
parentc3bd1d60af97e8d2568dac9fcce7bdabb4ff93c8 (diff)
downloadffmpeg-6bdae41d3ef74a0865e8f87896e649f93b2f39bd.tar.gz
matroskadec: Check memory allocations
CC: libav-stable@libav.org
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 697e14c30c..d352c8bd2f 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1710,6 +1710,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
return AVERROR_INVALIDDATA;
track->audio.buf = av_malloc(track->audio.frame_size *
track->audio.sub_packet_h);
+ if (!track->audio.buf)
+ return AVERROR(ENOMEM);
if (codec_id == AV_CODEC_ID_RA_288) {
st->codec->block_align = track->audio.coded_framesize;
track->codec_priv.size = 0;
@@ -2270,6 +2272,10 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
offset = 8;
pkt = av_mallocz(sizeof(AVPacket));
+ if (!pkt) {
+ av_freep(&pkt_data);
+ return AVERROR(ENOMEM);
+ }
/* XXX: prevent data copy... */
if (av_new_packet(pkt, pkt_size + offset) < 0) {
av_free(pkt);