aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2016-12-05 09:29:12 -0800
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-12-08 15:53:58 -0500
commitd3da8a0035734529c4e26696c9a0c6cb56633838 (patch)
tree7778748d97ff8c55729407920440b64078079f13 /libavcodec
parentd32bdadda86b35c2960e4de877cf081b9d2dadb3 (diff)
downloadffmpeg-d3da8a0035734529c4e26696c9a0c6cb56633838.tar.gz
omx: Fix allocation check
Also use av_mallocz_array(). Bug-Id: CID 1396839 Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/omx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index 0c61c2f536..05c874323c 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;
}