avfilter/avfilter: use av_malloc(z)_array()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-07-19 19:42:46 +02:00
parent d13a731fc1
commit d9ddbaa924
1 changed files with 4 additions and 4 deletions

View File

@ -627,22 +627,22 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
ret->nb_inputs = avfilter_pad_count(filter->inputs); ret->nb_inputs = avfilter_pad_count(filter->inputs);
if (ret->nb_inputs ) { if (ret->nb_inputs ) {
ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs); ret->input_pads = av_malloc_array(ret->nb_inputs, sizeof(AVFilterPad));
if (!ret->input_pads) if (!ret->input_pads)
goto err; goto err;
memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs); memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs);
ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs); ret->inputs = av_mallocz_array(ret->nb_inputs, sizeof(AVFilterLink*));
if (!ret->inputs) if (!ret->inputs)
goto err; goto err;
} }
ret->nb_outputs = avfilter_pad_count(filter->outputs); ret->nb_outputs = avfilter_pad_count(filter->outputs);
if (ret->nb_outputs) { if (ret->nb_outputs) {
ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs); ret->output_pads = av_malloc_array(ret->nb_outputs, sizeof(AVFilterPad));
if (!ret->output_pads) if (!ret->output_pads)
goto err; goto err;
memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs); memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs);
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs); ret->outputs = av_mallocz_array(ret->nb_outputs, sizeof(AVFilterLink*));
if (!ret->outputs) if (!ret->outputs)
goto err; goto err;
} }