diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-09-16 22:20:08 +0400 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-09-17 22:29:48 +0400 |
commit | 78f680cb3664624fedc00d03b0cd77255da2776b (patch) | |
tree | 460e00195680b2024f7ff23fc11218604d086ea2 /libavformat/smacker.c | |
parent | 7703d19c40220419279670d7fc3ac22bd2a91f83 (diff) |
avformat/smacker: use av_malloc_array() and check for allocation error
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat/smacker.c')
-rw-r--r-- | libavformat/smacker.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 062195b730..7279f95a19 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -142,8 +142,13 @@ static int smacker_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames); return AVERROR_INVALIDDATA; } - smk->frm_size = av_malloc(smk->frames * 4); + smk->frm_size = av_malloc_array(smk->frames, sizeof(*smk->frm_size)); smk->frm_flags = av_malloc(smk->frames); + if (!smk->frm_size || !smk->frm_flags) { + av_freep(&smk->frm_size); + av_freep(&smk->frm_flags); + return AVERROR(ENOMEM); + } smk->is_ver4 = (smk->magic != MKTAG('S', 'M', 'K', '2')); |