Re: Setting variable NULL after freeing it.

From: A
Date: Sat Nov 12 2022 - 07:16:26 EST


On Sat, Nov 12, 2022 at 5:31 PM Willy Tarreau <w@xxxxxx> wrote:
>
> On Sat, Nov 12, 2022 at 05:28:04PM +0530, A wrote:
> > I was just thinking that when this is good practice (where its usage
> > is genuine), then why is there not a kernel wide macro that would call
> > kfree(x) and then set (x) = NULL. So, this will be done automatically
> > for everyone and the developer will not have to decide whether to do
> > this or not.
>
> Very likely because developers want to decide.
>
> Willy

Yeah, may be they want to save the time the kernel will spend in doing
(x) = NULL.

Amit