Browse Source

omx: Fix OOM check

Also use av_mallocz_array().

Fixes CID1396839.

(cherry picked from commit 16a75304fe)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.2.5
Timothy Gu Michael Niedermayer 9 years ago
parent
commit
efc708afae
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavcodec/omx.c

+ 2
- 2
libavcodec/omx.c View File

@@ -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;
}


Loading…
Cancel
Save