> What about a real_exception variant that accepts STRING*'s as arguments? > > On the other hand, as you said, there will be other functions which > don't return control (functions that call real_exception etc.). But > then char* is not the only problem, any malloced data can leak. > > void f() { > void* leaked = malloc(n); > do_something(leaked); // does not come back > free(leaked); > } > void do_something(void*) { > something_else(); > } > void something_else() { > if(condition) real_exception(); > }
But you are 100% sure you are leaking in the real_exception case, of course. -- Mehmet