diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-09-27 01:17:46 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-09-27 01:17:46 +0000 |
commit | b1a05b820e6ee4d4209bc356348451bb4ad5870a (patch) | |
tree | 28e542f945a716d14bc2532d944ba326ad2135d0 /libavfilter/avfilter.c | |
parent | 41f87daaa300f06f869098c9f27e06ef3d8f54d5 (diff) | |
download | ffmpeg-b1a05b820e6ee4d4209bc356348451bb4ad5870a.tar.gz |
Make avfilter_destroy() code less convoluted, introducing a temporary
variable link.
Originally committed as revision 25217 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 221dfaa9e0..f6c62dd6a9 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -526,27 +526,28 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in void avfilter_destroy(AVFilterContext *filter) { int i; + AVFilterLink *link; if (filter->filter->uninit) filter->filter->uninit(filter); for (i = 0; i < filter->input_count; i++) { - if (filter->inputs[i]) { - if (filter->inputs[i]->src) - 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); + if ((link = filter->inputs[i])) { + if (link->src) + link->src->outputs[link->srcpad] = NULL; + avfilter_formats_unref(&link->in_formats); + avfilter_formats_unref(&link->out_formats); } - av_freep(&filter->inputs[i]); + av_freep(&link); } for (i = 0; i < filter->output_count; i++) { - if (filter->outputs[i]) { - if (filter->outputs[i]->dst) - 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); + if ((link = filter->outputs[i])) { + if (link->dst) + link->dst->inputs[link->dstpad] = NULL; + avfilter_formats_unref(&link->in_formats); + avfilter_formats_unref(&link->out_formats); } - av_freep(&filter->outputs[i]); + av_freep(&link); } av_freep(&filter->name); |