Revision b1a05b82

View differences:

libavfilter/avfilter.c
526 526
void avfilter_destroy(AVFilterContext *filter)
527 527
{
528 528
    int i;
529
    AVFilterLink *link;
529 530

  
530 531
    if (filter->filter->uninit)
531 532
        filter->filter->uninit(filter);
532 533

  
533 534
    for (i = 0; i < filter->input_count; i++) {
534
        if (filter->inputs[i]) {
535
            if (filter->inputs[i]->src)
536
                filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
537
            avfilter_formats_unref(&filter->inputs[i]->in_formats);
538
            avfilter_formats_unref(&filter->inputs[i]->out_formats);
535
        if ((link = filter->inputs[i])) {
536
            if (link->src)
537
                link->src->outputs[link->srcpad] = NULL;
538
            avfilter_formats_unref(&link->in_formats);
539
            avfilter_formats_unref(&link->out_formats);
539 540
        }
540
        av_freep(&filter->inputs[i]);
541
        av_freep(&link);
541 542
    }
542 543
    for (i = 0; i < filter->output_count; i++) {
543
        if (filter->outputs[i]) {
544
            if (filter->outputs[i]->dst)
545
                filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
546
            avfilter_formats_unref(&filter->outputs[i]->in_formats);
547
            avfilter_formats_unref(&filter->outputs[i]->out_formats);
544
        if ((link = filter->outputs[i])) {
545
            if (link->dst)
546
                link->dst->inputs[link->dstpad] = NULL;
547
            avfilter_formats_unref(&link->in_formats);
548
            avfilter_formats_unref(&link->out_formats);
548 549
        }
549
        av_freep(&filter->outputs[i]);
550
        av_freep(&link);
550 551
    }
551 552

  
552 553
    av_freep(&filter->name);

Also available in: Unified diff