summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-27 12:26:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-27 12:26:27 +0200
commit0bd15938ec5e0d5d77e217e7e3ce73c7c188ee5c (patch)
tree213d70fefe37860da46a892dd0fbd86ee63d8b4f /libavformat
parent535d9a938672af0155bae430e23a9ada35f40ff4 (diff)
parent4d122b01e4ce539269ee2df193b061772c7374f6 (diff)
Merge commit '4d122b01e4ce539269ee2df193b061772c7374f6'
* commit '4d122b01e4ce539269ee2df193b061772c7374f6': movenc: Check for allocation failures in mov_create_chapter_track Merged-by: Michael Niedermayer <michaelni@gmx.at>
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 2fcdaad1dd..7011290c8e 100644
--- a/libavformat/movenc.c
+++ b/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->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);