summaryrefslogtreecommitdiff
path: root/libavcodec/omx.c
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2016-12-05 09:24:47 -0800
committerTimothy Gu <timothygu99@gmail.com>2016-12-06 13:20:55 -0800
commit16a75304fe42d3a007c78126b6370c94ccf891f6 (patch)
treefb2ca5c9e1ac8d93a9a982aa48723328ccad4b47 /libavcodec/omx.c
parent581f93f37ef2e7a00662828ed0348d1edb9041fe (diff)
omx: Fix OOM check
Also use av_mallocz_array(). Fixes CID1396839.
Diffstat (limited to 'libavcodec/omx.c')
-rw-r--r--libavcodec/omx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index c1b6fb9847..b5093f4941 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;
}