title: Best pratice to free allocated memory on SIGINT
body: <p>I have a simple program which uses <code>select</code> and stuff like that for multiplexing IO.<br>
  To interrupt the "server" process, I integrated a sig_handler which reacts on <strong>SIGINT</strong>.</p>
  
  <p>Each time when memory is allocated, the containing method does the free itself or the calling method.</p>
  
  <p>Using <code>valgrind</code> shows up, that there are some allocation aren't freed up.<br>
  Perhaps there is no need for it, but I want to learn what would be the best way to handle the signal.<br>
  It seems that the <code>free</code> calls aren't invoked when pressing <em>STRG + C</em>.<br>
  So it would be senseless to quit loops with a break condition, which was my first approach.</p>
  
  <p>Is there any possibility to clean every thing up, before closing the whole program?</p>
  
  <p>Thanks for any hints and advices.</p>