aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-22 20:20:13 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-22 20:20:13 +0100
commit3518925a9127e368b6d0c7e8fd86510d34af40a1 (patch)
treea00ad6aeefd93815cce5c52ee0484e2f795855a8 /libavformat/movenc.c
parent40adcf576f7d93cc46269ce73f64a1d4638ad786 (diff)
downloadffmpeg-3518925a9127e368b6d0c7e8fd86510d34af40a1.tar.gz
avformat/movenc: Check for memory allocation failures
Fixes CID1271049 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a72f84e530..210f78e5ae 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4563,12 +4563,16 @@ static int mov_create_timecode_track(AVFormatContext *s, int index, int src_inde
/* encode context: tmcd data stream */
track->enc = avcodec_alloc_context3(NULL);
+ if (!track->enc)
+ return AVERROR(ENOMEM);
track->enc->codec_type = AVMEDIA_TYPE_DATA;
track->enc->codec_tag = track->tag;
track->enc->time_base = av_inv_q(rate);
/* the tmcd track just contains one packet with the frame number */
pkt.data = av_malloc(pkt.size);
+ if (!pkt.data)
+ return AVERROR(ENOMEM);
AV_WB32(pkt.data, tc.start);
ret = ff_mov_write_packet(s, &pkt);
av_free(pkt.data);