Re: [PATCH] include/linux/slab.h: new KFREE() macro.

Valdis.Kletnieks
2007-01-08T22:43:38Z

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

On Mon, 08 Jan 2007 01:06:12 PST, Amit Choudhary said:
> I do not see how a double free can result in _logical_wrong_behaviour_ of the program and the
> program keeps on running (like an incoming packet being dropped because of double free). Double
> free will _only_and_only_ result in system crash that can be solved by setting 'x' to NULL.

The problem is that very rarely is there a second free() with no intervening
use - what actually *happens* usually is:

1) You alloc the memory
2) You use the memory
3) You take a reference on the memory, so you know where it is.
4) You free the memory
5) You use the memory via the reference you took in (3)
6) You free it again - at which point you finally know for sure that
everything in step 5 was doing a fandango on core....

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]