1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

matroska_parse_rm_audio: check for malloc failure

Fixes CID733712
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-10-20 16:55:45 +02:00
parent d7cabb3c7e
commit 1116491c53

View File

@ -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;