Fix Mismatched free() / delete / delete [] error reported by valgrind