On Sat, Mar 11, 2017 at 04:38:56PM +0100, onkel.jack@xxxxxxxxxxx wrote: > Dont mess up p and (*p). > > Its true the the content of the memory p points to may change after free, depending on what other threads do and what the operating system is doing on free. > but the value of p, which contains the address of the allocated memory, does not change at free. > Its till holds that address. > > This means, p stay as is but *p may change. No, that is not how it works. 6.2.4/2 says: [...] "The value of a pointer becomes indeterminate when the object it points to (or just past) reaches the end of its lifetime." It does not matter whether the value of p changes in *your* system, or in most systems. Using the value of p after deallocating the object it pointed to is undefined behaviour. Segher