[FFmpeg-user] How to correctly free a double-linked list
Paul B Mahol
onemda at gmail.com
Sun Jul 7 16:07:58 EEST 2019
On 7/7/19, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
>
> 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:
Maybe:
s->shifts_sums = av_calloc(s->lines + 1, sizeof(**s->shifts_sums));
>
> 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
>
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list