summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-08-25 21:23:58 +0300
committerMartin Storsjö <martin@martin.st>2013-08-27 10:25:55 +0300
commit4d122b01e4ce539269ee2df193b061772c7374f6 (patch)
treecceb058f8beeaf770ea86fffb9b23e785e6d9770 /libavformat
parent4eb4bb3a022a4126f5f749ad971f644467c0369e (diff)
movenc: Check for allocation failures in mov_create_chapter_track
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 07807612f3..dc13a4be0e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3018,6 +3018,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;
track->enc->extradata = av_malloc(sizeof(chapter_properties));
if (track->enc->extradata == NULL)
@@ -3037,6 +3039,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);