Showing the changes to libavfilter/avfilter.c (1 of 1 file). Show all
Unified · Split
| @@ -428,10 +428,28 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 427 unmodified lines | |||
| 428 | } | 428 | } |
| 429 | #endif | 429 | #endif |
| 430 | 430 | ||
| 431 | static void free_link(AVFilterLink *link) | ||
| 432 | { | ||
| 433 | if (!link) | ||
| 434 | return; | ||
| 435 | |||
| 436 | if (link->src) | ||
| 437 | link->src->outputs[link->srcpad - link->src->output_pads] = NULL; | ||
| 438 | if (link->dst) | ||
| 439 | link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; | ||
| 440 | |||
| 441 | ff_formats_unref(&link->in_formats); | ||
| 442 | ff_formats_unref(&link->out_formats); | ||
| 443 | ff_formats_unref(&link->in_samplerates); | ||
| 444 | ff_formats_unref(&link->out_samplerates); | ||
| 445 | ff_channel_layouts_unref(&link->in_channel_layouts); | ||
| 446 | ff_channel_layouts_unref(&link->out_channel_layouts); | ||
| 447 | av_freep(&link); | ||
| 448 | } | ||
| 449 | |||
| 431 | void avfilter_free(AVFilterContext *filter) | 450 | void avfilter_free(AVFilterContext *filter) |
| 432 | { | 451 | { |
| 433 | int i; | 452 | int i; |
| 434 | AVFilterLink *link; | ||
| 435 | 453 | ||
| 436 | if (filter->graph) | 454 | if (filter->graph) |
| 437 | ff_filter_graph_remove_filter(filter->graph, filter); | 455 | ff_filter_graph_remove_filter(filter->graph, filter); |
| @@ -440,30 +458,10 @@ void avfilter_free(AVFilterContext *filter) · 2 unmodified lines | |||
| 440 | filter->filter->uninit(filter); | 458 | filter->filter->uninit(filter); |
| 441 | 459 | ||
| 442 | for (i = 0; i < filter->nb_inputs; i++) { | 460 | for (i = 0; i < filter->nb_inputs; i++) { |
| 443 | if ((link = filter->inputs[i])) { | 461 | free_link(filter->inputs[i]); |
| 444 | if (link->src) | ||
| 445 | link->src->outputs[link->srcpad - link->src->output_pads] = NULL; | ||
| 446 | ff_formats_unref(&link->in_formats); | ||
| 447 | ff_formats_unref(&link->out_formats); | ||
| 448 | ff_formats_unref(&link->in_samplerates); | ||
| 449 | ff_formats_unref(&link->out_samplerates); | ||
| 450 | ff_channel_layouts_unref(&link->in_channel_layouts); | ||
| 451 | ff_channel_layouts_unref(&link->out_channel_layouts); | ||
| 452 | } | ||
| 453 | av_freep(&link); | ||
| 454 | } | 462 | } |
| 455 | for (i = 0; i < filter->nb_outputs; i++) { | 463 | for (i = 0; i < filter->nb_outputs; i++) { |
| 456 | if ((link = filter->outputs[i])) { | 464 | free_link(filter->outputs[i]); |
| 457 | if (link->dst) | ||
| 458 | link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; | ||
| 459 | ff_formats_unref(&link->in_formats); | ||
| 460 | ff_formats_unref(&link->out_formats); | ||
| 461 | ff_formats_unref(&link->in_samplerates); | ||
| 462 | ff_formats_unref(&link->out_samplerates); | ||
| 463 | ff_channel_layouts_unref(&link->in_channel_layouts); | ||
| 464 | ff_channel_layouts_unref(&link->out_channel_layouts); | ||
| 465 | } | ||
| 466 | av_freep(&link); | ||
| 467 | } | 465 | } |
| 468 | 466 | ||
| 469 | if (filter->filter->priv_class) | 467 | if (filter->filter->priv_class) |