I've got a problem with some code. It does something like this:
- create a pointer p (char *)
- allocate a buffer pointed to by p
- fill buffer with data
- assign another pointer q (char *) to the buffer
- set p to NULL
- use pointer q, increment it to the end of the buffer
- free q
My question is, what happens to the buffer, and more importantly the program? The pointer has been moved to the end of the buffer before it has been free'd. This program runs on several different unix platforms and crashes on one of them - at the free.
cheers to anyone who can help.
(sorry I can't list any code as it's split all over the place).