Make avfilter_destroy() code less convoluted, introducing a temporary

variable link.

Originally committed as revision 25217 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Stefano Sabatini 2010-09-27 01:17:46 +00:00
parent 41f87daaa3
commit b1a05b820e

View File

@ -526,27 +526,28 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
void avfilter_destroy(AVFilterContext *filter) void avfilter_destroy(AVFilterContext *filter)
{ {
int i; int i;
AVFilterLink *link;
if (filter->filter->uninit) if (filter->filter->uninit)
filter->filter->uninit(filter); filter->filter->uninit(filter);
for (i = 0; i < filter->input_count; i++) { for (i = 0; i < filter->input_count; i++) {
if (filter->inputs[i]) { if ((link = filter->inputs[i])) {
if (filter->inputs[i]->src) if (link->src)
filter->inputs[i]->src->outputs[filter->inputs[i]->srcpad] = NULL; link->src->outputs[link->srcpad] = NULL;
avfilter_formats_unref(&filter->inputs[i]->in_formats); avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&filter->inputs[i]->out_formats); avfilter_formats_unref(&link->out_formats);
} }
av_freep(&filter->inputs[i]); av_freep(&link);
} }
for (i = 0; i < filter->output_count; i++) { for (i = 0; i < filter->output_count; i++) {
if (filter->outputs[i]) { if ((link = filter->outputs[i])) {
if (filter->outputs[i]->dst) if (link->dst)
filter->outputs[i]->dst->inputs[filter->outputs[i]->dstpad] = NULL; link->dst->inputs[link->dstpad] = NULL;
avfilter_formats_unref(&filter->outputs[i]->in_formats); avfilter_formats_unref(&link->in_formats);
avfilter_formats_unref(&filter->outputs[i]->out_formats); avfilter_formats_unref(&link->out_formats);
} }
av_freep(&filter->outputs[i]); av_freep(&link);
} }
av_freep(&filter->name); av_freep(&filter->name);