title: Calling free on a pointer twice
body: <p>I have been taught in lectures, that calling <code>free()</code> on a pointer twice is really, really bad. I know that it is good practice, to set a pointer to <code>NULL</code>, right after having freed it. </p>
  
  <p>However, I still have never heard any explanation as to why that is. From what I understand, the way <code>malloc()</code> works, it should technically keep track of the pointers it has allocated and given you to use. So why does it not know, whether a pointer it receives through <code>free()</code> has been freed yet or not? </p>
  
  <p>I would love to understand, what happens internally, when you call <code>free()</code> on a location that has previously already been freed.</p>