On Win7 32bit in an simple validation app using a statically linked libxml2, the following code SEGV's
https://github.com/jonforums/xvalid/blob/master/src/xvalid.c#L58-119 at line 114 in `xmlFreeParserInputBuffer(input)` with the following gdb info: C:\projects\xvalid-git>gdb --args xval.exe --xsd test\nested.xsd test\nested.xml ... Breakpoint 1, xvalid__xsd_validate (ctx=0x22fe88) at src/xvalid.c:107 107 xsd_valid_ctx = NULL; (gdb) s 108 xmlFreeParserInputBuffer(input); (gdb) xmlFreeParserInputBuffer (in=0x2f1f98) at xmlIO.c:2417 2417 if (in == NULL) return; (gdb) 2419 if (in->raw) { (gdb) 2420 xmlBufferFree(in->raw); (gdb) xmlBufferFree (buf=0xfeeefeee) at tree.c:6980 6980 if (buf == NULL) { (gdb) 6988 if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (gdb) Program received signal SIGSEGV, Segmentation fault. xmlBufferFree (buf=0xfeeefeee) at tree.c:6988 6988 if ((buf->alloc == XML_BUFFER_ALLOC_IO) && I statically link to a mingw gcc 4.6.2 built libxml2 v2.7.8 configured as: https://github.com/jonforums/xvalid/blob/master/doc/faq.mkd I'm ramping up on the codebase and API so I don't yet grok the API. Deleting lines 114 and 115 make the SEGV go away, but I think removing those lines is wrong as I want to iterate over a bunch of xml files, validate each one, and then cleanup between iterations. While the last part of the gdb trace surprises me, I'd like to better understand how the API *should* be used in this XSD validation scenario as I'm clearly not doing it right. In general, when and how should `xmlFreeXXX` fcns be used, and what specifically am I doing wrong in my snippet? Jon --- blog: http://jonforums.github.com/ twitter: @jonforums "Anyone who can only think of one way to spell a word obviously lacks imagination." - Mark Twain _______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml