title: Freeing heap on exit in C automatically
body: <p>I have an assignment where my functions <code>foo</code> and <code>bar</code> are going to be tested, both of which allocate memory on the heap.
  The thing is, I'm not allowed to change <code>int main</code>. If the examiner calls <code>foo</code> and/or <code>bar</code> in <code>int main</code>, then how am I meant to deallocate this space (since I can't change <code>main</code>)?</p>
  <p>I was thinking about adding a function call on program termination, but isn't this only possible if I define that function call in <code>main</code> (which I can't edit)?</p>