aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-20 16:55:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-20 16:55:45 +0200
commit1116491c53156dd1972eca3e65d5a3b8529c4658 (patch)
tree2a7b8a1303753e84e8b247002b7dd0def70bc5bf
parentd7cabb3c7e843c2028b398cb19a40db84d40c790 (diff)
downloadffmpeg-1116491c53156dd1972eca3e65d5a3b8529c4658.tar.gz
matroska_parse_rm_audio: check for malloc failure
Fixes CID733712 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/matroskadec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index ddebf2b697..954cedf8ed 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2043,8 +2043,11 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
}
while (track->audio.pkt_cnt) {
- AVPacket *pkt = av_mallocz(sizeof(AVPacket));
- av_new_packet(pkt, a);
+ AVPacket *pkt = NULL;
+ if (!(pkt = av_mallocz(sizeof(AVPacket))) || av_new_packet(pkt, a) < 0){
+ av_free(pkt);
+ return AVERROR(ENOMEM);
+ }
memcpy(pkt->data, track->audio.buf
+ a * (h*w / a - track->audio.pkt_cnt--), a);
pkt->pts = track->audio.buf_timecode;