Re: [xml] memory corruption on copying XML!?



OK, I found the reason for the problem. The DLLs, that modify the 
XMLs and use the libxml2, use it statically linked. And the problem 
was the "text" name of the text nodes. I traced my specific problem 
down to tree.c and the function xmlNewText. The "cur->name" is set 
there and it is set to the global const char array "xmlStringText". 
And because it's set to that global var it does point to the memory 
of that global var and when I unload the DLL that memory is gone. So 
it has to be set with xmlStrdup() instead, so it does still exists 
after the DLL is gone. This also applies to the vars 
"xmlStringTextNoenc" and "xmlStringComment".



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]