You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Bruce Bailey <bj...@plaza.ds.adp.com> on 2001/06/13 23:24:34 UTC
Correct Way to dispose of strings from XMLString::transcode
Hi
When trying to run the following program, I keep getting an invalid heap
pointer error. This occurs whenever I try to delete either the XML string
or the normal string. If I don't use 'delete', I get memory leaks. Any
ideas as to what might be the problem?
Thanks.
Bruce
Platform: Winnt 4.0 (not sure of sp level, but I think it's 5)
Compiler: vc 6.0
Xerces version: VER=1_4
#include <util\XMLString.hpp>
#include <util/PlatformUtils.hpp>
int
main(int argc, char *argv[])
{
XMLPlatformUtils::Initialize();
XMLCh *x = XMLString::transcode("This is a test");
char *p = XMLString::transcode(x);
delete x; /* delete[] x doesn't work either*/
delete[]p;
XMLPlatformUtils::Terminate();
return 0;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org