Skip to content

Commit

Permalink
omx: Fix OOM check
Browse files Browse the repository at this point in the history
Also use av_mallocz_array().

Fixes CID1396839.
  • Loading branch information
TimothyGu committed Dec 6, 2016
1 parent 581f93f commit 16a7530
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libavcodec/omx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 16a7530

Please sign in to comment.