In a C program, if I try to use malloc and for some reason the pointer is NULL, I will terminate the program with exit(1); as without that block of memory the program is essentially unusable. Upon using exit(1); should I be releasing all of the memory I had allocated during the program or does that happen automatically?
exit()is usually for emergency termination.main()it's good practice to clean up. If you can't easily do that, it perhaps shows a poorly organised data structure.freeis not expected to help.freeupdates records internal to the process.