I’m working in a project and I use the xerces library. When I try to delete a pointer my project crashes.
Here is the source code:
std::ostream& operator<<(std::ostream& target, const DOMString& s)
{
char *p = s.transcode(); // method from xerces
target << p;
delete [] p;
return target;
}
This method works fine in Visual Studio 6 (I’m trying to build in 2010).
From the xerces docs:
It seems that xerces allocates the buffer not with
new[](perhapsmallocor some custom allocator). The only way to guarantee that the buffer safely gets deallocated is with:XMLString::release