avfilter: free link in/out_formats in avfilter_destroy()
authorMåns Rullgård <mans@mansr.com>
Fri, 6 Aug 2010 22:25:33 +0000 (22:25 +0000)
committerMåns Rullgård <mans@mansr.com>
Fri, 6 Aug 2010 22:25:33 +0000 (22:25 +0000)
Originally committed as revision 24718 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/avfilter.c

index c040a9c..d4ce977 100644 (file)
@@ -428,13 +428,19 @@ void avfilter_destroy(AVFilterContext *filter)
         filter->filter->uninit(filter);
 
     for(i = 0; i < filter->input_count; i ++) {
         filter->filter->uninit(filter);
 
     for(i = 0; i < filter->input_count; i ++) {
-        if(filter->inputs[i])
+        if(filter->inputs[i]) {
             filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
             filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL;
+            avfilter_formats_unref(&filter->inputs[i]->in_formats);
+            avfilter_formats_unref(&filter->inputs[i]->out_formats);
+        }
         av_freep(&filter->inputs[i]);
     }
     for(i = 0; i < filter->output_count; i ++) {
         av_freep(&filter->inputs[i]);
     }
     for(i = 0; i < filter->output_count; i ++) {
-        if(filter->outputs[i])
+        if(filter->outputs[i]) {
             filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
             filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL;
+            avfilter_formats_unref(&filter->outputs[i]->in_formats);
+            avfilter_formats_unref(&filter->outputs[i]->out_formats);
+        }
         av_freep(&filter->outputs[i]);
     }
 
         av_freep(&filter->outputs[i]);
     }