Re: [2.4] init/do_mounts.c::rd_load_image() memleak

Jens Axboe
2003-03-14T07:58:27Z

On Fri, Mar 14 2003, Oleg Drokin wrote:
> Hello!
>
> On Fri, Mar 14, 2003 at 08:59:57AM +0100, Jens Axboe wrote:
>
> > > > > + if (buf)
> > > > > + kfree(buf);
> > > > kfree(NULL); is valid - you don't need this check.
> > > Almost every place I can think of does just this, so I do not see why this
> > > particular piece of code should be different.
> > Since when has that been a valid argument? :)
>
> Well, my argument is code uniformness which was always valid as long
> as it does not introduce any bugs, I think.

I agree with that.

> Do you propose somebody should go and fix all
> if ( something )
> kfree(something);
> pieces of code to read just
> kfree(something); ?

No that would just be another pointless exercise in causing more
annoyance for someone who has to look through patches finding that one
hunk that breaks stuff. The recent spelling changes come to mind.

But just because you don't seem to have seen any kfree(NULL) in the
kernel does not mean they are not there. And should a good trend not
allow to grow?

--
Jens Axboe