lavfi/avfiltergraph: fix leak on error

Introduced in eddffbedb3

Fixes: CID1618897 Resource leak
Signed-off-by: Anton Khirnov <anton@khirnov.net>
release/7.1
Marvin Scholz 4 months ago committed by Anton Khirnov
parent fe4b9ef69f
commit 9556379943
  1. 4
      libavfilter/avfiltergraph.c

@ -372,8 +372,10 @@ static int filter_query_formats(AVFilterContext *ctx)
if (ctx->nb_outputs > FF_ARRAY_ELEMS(cfg_out_stack)) {
cfg_out_dyn = av_malloc_array(ctx->nb_outputs, sizeof(*cfg_out_dyn));
if (!cfg_out_dyn)
if (!cfg_out_dyn) {
av_freep(&cfg_in_dyn);
return AVERROR(ENOMEM);
}
cfg_out = cfg_out_dyn;
} else
cfg_out = ctx->nb_outputs ? cfg_out_stack : NULL;

Loading…
Cancel
Save