[xml] Strange segmentation fault on Win32 with htmlCreatePushParserCtxt


I've been using libxml2 for about a months now in developing a parser
for web pages and it works quite well.... but I'm a bit confused about
the differences between the htmlparser and the xmlparser.

I'm calling xmlCleanupParser at the end of my code to "reclaim all
parsing related global memory allocated for the parser" which fixed
a slight memory leak. Then I thought that I should be calling xmlInitParser
before using my libraries. Unfortunately this gives me a NULL pointer
whenever I call htmlCreatePushParserCtxt later on. The stack trace of
the problem is as follows

xmlGetGlobalState + 15 bytes <--------- NULL pointer dereference.
__xmlDefaultBufferSize + 24 bytes
xmlBufferCreate + 66 bytes
xmlAllocParserInputBuffer + 72 bytes
htmlCreatePushParserCtxt + 22 bytes

If I remove the call to xmlInitParser, every thing is ok. I'm not sure if
is user error, library configuration (I'vI enabled threads when building
or an actual bug. (I'm thinking user error at the moment).

the version I'm using is 2.4.24
I'm compiling with VC++ 6.0 on windows 2k service pack 2.


Matthew Love

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