Merge commit '4d122b01e4ce539269ee2df193b061772c7374f6'

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
pull/37/head
Michael Niedermayer 12 years ago
commit 0bd15938ec
  1. 4
      libavformat/movenc.c

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

Loading…
Cancel
Save