diff options
author | Timothy Gu <timothygu99@gmail.com> | 2016-12-05 09:24:47 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-14 12:20:15 +0200 |
commit | efc708afae75016192519ea4ba1387fedab0c369 (patch) | |
tree | a7ab5bc67906b9a854f15892f4ee0a487c2d4486 | |
parent | d4f4fa22d7acb256f7cedc6098f2a294ebfb3f32 (diff) | |
download | ffmpeg-efc708afae75016192519ea4ba1387fedab0c369.tar.gz |
omx: Fix OOM check
Also use av_mallocz_array().
Fixes CID1396839.
(cherry picked from commit 16a75304fe42d3a007c78126b6370c94ccf891f6)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/omx.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/omx.c b/libavcodec/omx.c index 2fe21429c2..16df50e456 100644 --- a/libavcodec/omx.c +++ b/libavcodec/omx.c @@ -352,12 +352,12 @@ static av_cold int find_component(OMXContext *omx_context, void *logctx, av_log(logctx, AV_LOG_WARNING, "No component for role %s found\n", role); return AVERROR_ENCODER_NOT_FOUND; } - components = av_mallocz(sizeof(char*) * num); + components = av_mallocz_array(num, sizeof(*components)); if (!components) return AVERROR(ENOMEM); for (i = 0; i < num; i++) { components[i] = av_mallocz(OMX_MAX_STRINGNAME_SIZE); - if (!components) { + if (!components[i]) { ret = AVERROR(ENOMEM); goto end; } |