[FFmpeg-user] How to correctly free a double-linked list
Ulf Zibis
Ulf.Zibis at gmx.de
Sun Jul 7 16:04:02 EEST 2019
Am 07.07.19 um 14:29 schrieb Paul B Mahol:
> On 7/7/19, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
>> Am 07.07.19 um 13:51 schrieb Paul B Mahol:
>>> There is av_calloc, it calls memset for you after allocation
>> Thanks for the hint. I now have:
>> if (s->report >= R_SHIFTS) {
>> s->shifts_sums = av_malloc((s->lines + 1) *
>> sizeof(*s->shifts_sums));
> This above needs to be calloc.
Unfortunately this doesn't help. So I ask:
Isn't this enough initialization? :
for (int l = s->lines; l >= 0; l--)
s->shifts_sums[l] = av_calloc(s->span_r - s->span_l + 1,
sizeof(**s->shifts_sums));
I don't get, why I first should write NULLs into the elements of
s->shifts_sums[l].
-Ulf
More information about the ffmpeg-user
mailing list