[Solved] Crash at program exit

I have some code that looks like this, similar to some of the samples:

void main() {
bool use_glut=true;


if(use_glut) {
    // Path 1
} else {
    // Path 2
cout << "done" << endl;

Whether I take path 1 or path 2, I reach “done” and see the expected output (either a glut window or a .ppm image file created). However, on path 2, at program exit I see a glibc sigdump complaining of “double free or corruption”. It’s likely my code has a bug in it, but why would Path 2 exhibit this and not Path 1?

Can you post some more code? Since the SDK sample doesn’t exhibit this behavior I’m assuming there’s something wrong in the additional code

User error, I’ll mark it solved. I was getting the “double free” error because (surprise surprise) I was freeing an array twice.

It still doesn’t explain why the error was only showing up on one path, but it’s a moot point now.