mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
movenc: Check for allocation failures in mov_create_chapter_track
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
4eb4bb3a02
commit
4d122b01e4
@ -3018,6 +3018,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;
|
||||||
track->enc->extradata = av_malloc(sizeof(chapter_properties));
|
track->enc->extradata = av_malloc(sizeof(chapter_properties));
|
||||||
if (track->enc->extradata == NULL)
|
if (track->enc->extradata == NULL)
|
||||||
@ -3037,6 +3039,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…
x
Reference in New Issue
Block a user