Commit 78f680cb authored by Paul B Mahol's avatar Paul B Mahol

avformat/smacker: use av_malloc_array() and check for allocation error

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 7703d19c
......@@ -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'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment