Merge commit 'd79bd6040599ef017dc45d5997fcc959ab1f71f6'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 18 May 2013 11:10:57 +0000 (13:10 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 18 May 2013 11:10:57 +0000 (13:10 +0200)
* commit 'd79bd6040599ef017dc45d5997fcc959ab1f71f6':
  lavfi: factorize freeing a link

Conflicts:
libavfilter/avfilter.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavfilter/avfilter.c

@@@ -622,14 -428,29 +622,32 @@@ int avfilter_open(AVFilterContext **fil
  }
  #endif
  
 -    av_freep(&link);
+ static void free_link(AVFilterLink *link)
+ {
+     if (!link)
+         return;
+     if (link->src)
+         link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
+     if (link->dst)
+         link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
+     ff_formats_unref(&link->in_formats);
+     ff_formats_unref(&link->out_formats);
+     ff_formats_unref(&link->in_samplerates);
+     ff_formats_unref(&link->out_samplerates);
+     ff_channel_layouts_unref(&link->in_channel_layouts);
+     ff_channel_layouts_unref(&link->out_channel_layouts);
++    avfilter_link_free(&link);
+ }
  void avfilter_free(AVFilterContext *filter)
  {
      int i;
-     AVFilterLink *link;
  
 +    if (!filter)
 +        return;
 +
      if (filter->graph)
          ff_filter_graph_remove_filter(filter->graph, filter);