Since memory is still mapped in your process but not allocated. C program has two levels of memory management: firstly, the kernel gives you pages that you can write to. If a process requires more memory that it has mapped, it must request more from the kernel (sbrk). This happens in large chunks, so malloc cuts it into chunks for you, requesting more pages as needed, but using, where possible, the memory already allocated for the program. free cannot return the page until all the resources allocated by it are freed.
Thus, the memory access violations that the kernel (SIGSEGV) gives are rather gross and cannot display most memory errors, but only things that are fatal in terms of the kernel. You can delete malloc tracking data, read it to the end of most distributions, and after many free ones, etc.
However, never make memory errors. Launch the application with valgrind, which uses a very strict virtual machine to check all errors and crush them immediately.
source share