title: C potential memory leak caused by abnormally terminating program
body: <p>Windows and Linux.</p>
  
  <p>When I allocate memory in my C program, good coding wants me to free the memory before the end of my program.</p>
  
  <p>Assume the following:</p>
  
  <pre><code>int main (int argc, char *argv[]) {
      char *f_name;
      FILE *i_file;
  
      f_name = malloc(some_amount);
      // put something in f_name */
      i_file = fopen(f_name, "r");
      if (i_file == NULL) {
          perror("Error opening file.");
          exit(EXIT_FAILURE);
      }
      free(f_name);
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>If the program terminates before I call "free", will the OS recover any un-freed memory when the program exits? Or will I just nibble away from my 3Gb or so available memory until a system restart?</p>
  
  <p>Thanks, Mark.</p>