Whitespace fixes
Set the destructor only when necessary.  Closes #347

and reset it before returning the memory to the caller