Program crashes and memory leaks
This is just out of curiousity about program crashes (any crash such as the "the application has encountered a problem and needs to close" message where you send an error report to Microsoft, or the "unhandled exception" thing) and memory leaks and various scenarios. What about when an infinite loop is encountered prior to reaching these 3 cases?
1. Let's say that, somewhere in my code, I have an fopen instruction and while supposedly reading the file that is successfully opened, the program crashes before it gets to the fclose. Will the result due to the crash be the same as if fclose was never used in the program?
2. Let's say you have a pointer pointing to 32 MB's worth of data (or something) and the program crashes before the "free" instruction is run across. Will there be a memory leak as if free was never called due to the program crashing?
3. What about other things like this such as using UnregisterClass in Windows programs (of which frees the memory)?