[FFmpeg-devel] [PATCH] avutil: Added selftest for libavutil/audio_fifo.c

James Almer jamrial at gmail.com
Thu Dec 22 04:28:10 EET 2016


On 12/21/2016 11:22 PM, Thomas Turner wrote:
> yeah, currently taking a look.

int tot_elements   = !(planes = av_sample_fmt_is_planar(afifo->sample_fmt))
                     ? samples : afifo->channels * samples;
void **data_planes = allocate_memory(sizeof(void*) * planes);

planes is zero when the sample_fmt is not planar, so you end up
calling malloc(0).
It should be channel count if planar, 1 otherwise. I think you
can just call malloc with afifo->nb_buffers * sizeof(void*) as
size.

This is also a good reason to use av_malloc_array() instead of
a plain malloc().



More information about the ffmpeg-devel mailing list