Wrapping raw delete calls inside conditionals. As I mentioned in comments, when
using custom allocators some systems do not support the new/delete operators.
Make sure to call delete only if we had already called new first.