1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-08 13:22:53 +02:00

Merge commit '4d122b01e4ce539269ee2df193b061772c7374f6'

* commit '4d122b01e4ce539269ee2df193b061772c7374f6':
  movenc: Check for allocation failures in mov_create_chapter_track

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-08-27 12:26:19 +02:00
commit 0bd15938ec

View File

@ -3393,6 +3393,8 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
track->tag = MKTAG('t','e','x','t');
track->timescale = MOV_TIMESCALE;
track->enc = avcodec_alloc_context3(NULL);
if (!track->enc)
return AVERROR(ENOMEM);
track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE;
#if 0
// These properties are required to make QT recognize the chapter track
@ -3460,6 +3462,8 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
len = strlen(t->value);
pkt.size = len + 2;
pkt.data = av_malloc(pkt.size);
if (!pkt.data)
return AVERROR(ENOMEM);
AV_WB16(pkt.data, len);
memcpy(pkt.data + 2, t->value, len);
ff_mov_write_packet(s, &pkt);