Revision 689a5f49 libavfilter/avfilter.c

View differences:

libavfilter/avfilter.c
341 341
    if (!filter)
342 342
        return 0;
343 343

  
344
    ret = av_malloc(sizeof(AVFilterContext));
344
    ret = av_mallocz(sizeof(AVFilterContext));
345 345

  
346 346
    ret->av_class = &avfilter_class;
347 347
    ret->filter   = filter;
......
349 349
    ret->priv     = av_mallocz(filter->priv_size);
350 350

  
351 351
    ret->input_count  = pad_count(filter->inputs);
352
    if (ret->input_count) {
352 353
    ret->input_pads   = av_malloc(sizeof(AVFilterPad) * ret->input_count);
353 354
    memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad)*ret->input_count);
354 355
    ret->inputs       = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
356
    }
355 357

  
356 358
    ret->output_count = pad_count(filter->outputs);
359
    if (ret->output_count) {
357 360
    ret->output_pads  = av_malloc(sizeof(AVFilterPad) * ret->output_count);
358 361
    memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad)*ret->output_count);
359 362
    ret->outputs      = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
363
    }
360 364

  
361 365
    return ret;
362 366
}

Also available in: Unified diff