[openib-general] [Fwd: [PATCH] RDMA/iwcm: Fix memory leak]

Roland Dreier rdreier at cisco.com
Thu Nov 9 15:10:37 PST 2006


 > I think the semantics are that the pointer is only used if
 > private_data_len > 0.  Otherwise, it is undefined.  So I think we should
 > keep the check.  Plus I don't like calling kfree() with a NULL pointer.
 > It just seems wrong...

Well, the first half definitely justifies leaving the check.

However you're wrong about kfree(NULL) :)  Every time you write

	if (foo)
		kfree(foo);

a kitten is killed... Seriously, the check is pure bloat that wastes
instruction cache, etc.

 - R.




More information about the general mailing list