Showing the changes to libavfilter/avfilter.c (1 of 1 file). Show all
Unified · Split
| @@ -659,10 +659,9 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) · 658 unmodified lines | |||
| 659 | 659 | ||
| 660 | ret->nb_inputs = avfilter_pad_count(filter->inputs); | 660 | ret->nb_inputs = avfilter_pad_count(filter->inputs); |
| 661 | if (ret->nb_inputs ) { | 661 | if (ret->nb_inputs ) { |
| 662 | ret->input_pads = av_malloc_array(ret->nb_inputs, sizeof(AVFilterPad)); | 662 | ret->input_pads = av_memdup(filter->inputs, ret->nb_inputs * sizeof(*filter->inputs)); |
| 663 | if (!ret->input_pads) | 663 | if (!ret->input_pads) |
| 664 | goto err; | 664 | goto err; |
| 665 | memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs); | ||
| 666 | ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*)); | 665 | ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*)); |
| 667 | if (!ret->inputs) | 666 | if (!ret->inputs) |
| 668 | goto err; | 667 | goto err; |
| @@ -670,10 +669,9 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name) · 1 unmodified line | |||
| 670 | 669 | ||
| 671 | ret->nb_outputs = avfilter_pad_count(filter->outputs); | 670 | ret->nb_outputs = avfilter_pad_count(filter->outputs); |
| 672 | if (ret->nb_outputs) { | 671 | if (ret->nb_outputs) { |
| 673 | ret->output_pads = av_malloc_array(ret->nb_outputs, sizeof(AVFilterPad)); | 672 | ret->output_pads = av_memdup(filter->outputs, ret->nb_outputs * sizeof(*filter->outputs)); |
| 674 | if (!ret->output_pads) | 673 | if (!ret->output_pads) |
| 675 | goto err; | 674 | goto err; |
| 676 | memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs); | ||
| 677 | ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*)); | 675 | ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*)); |
| 678 | if (!ret->outputs) | 676 | if (!ret->outputs) |
| 679 | goto err; | 677 | goto err; |