Skip to content

Commit

Permalink
vf_hwupload: Add missing return value check
Browse files Browse the repository at this point in the history
Add missing return value checks to suppress build warning and
remove noop ff_formats_unref() calling.

Note: most filters using ff_formats_ref() didn't have a suitable
error handling, it's a potential memory leak issue.

Signed-off-by: Jun Zhao <[email protected]>
Signed-off-by: Mark Thompson <[email protected]>
  • Loading branch information
mypopydev authored and fhvwy committed Mar 12, 2017
1 parent ff17c76 commit bf238a6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions libavfilter/vf_hwupload.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,15 @@ static int hwupload_query_formats(AVFilterContext *avctx)
if (input_pix_fmts) {
for (i = 0; input_pix_fmts[i] != AV_PIX_FMT_NONE; i++) {
err = ff_add_format(&input_formats, input_pix_fmts[i]);
if (err < 0) {
ff_formats_unref(&input_formats);
if (err < 0)
goto fail;
}
}
}

ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats);

ff_formats_ref(ff_make_format_list(output_pix_fmts),
&avctx->outputs[0]->in_formats);
if ((err = ff_formats_ref(input_formats, &avctx->inputs[0]->out_formats)) < 0 ||
(err = ff_formats_ref(ff_make_format_list(output_pix_fmts),
&avctx->outputs[0]->in_formats)) < 0)
goto fail;

av_hwframe_constraints_free(&constraints);
return 0;
Expand Down

0 comments on commit bf238a6

Please sign in to comment.