> I haven't had a chance to test this but it looks like you're deleting 
> pointers that you shouldn't be. Only call "delete" if there is a 
> corresponding "new". The general rule is that you shouldn't delete pointers 
> returned by Open Babel API calls, unless the documentation explicitly states 
> that the caller is responsible for freeing the memory. In 99% of cases, the 
> pointer is to a data structure that is managed by something else. In short, 
> trying commenting out "delete[] xyz".


 I'd highly recommend anyone writing C++ code to use sanitizer checks in GCC 
and Clang. Useful checks include leak detection, memory errors (like this), 
undefined behavior, etc.:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html 
<https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html>

Cheers,
-Geoff
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to