I was using xmlTextReaderGetAttribute (from xmlsoft.org) successfully before, but the API documentation requires that I deallocate the returned xmlChar*. Now my app crashes on the second (the first passes null) call to free(), shown below:
xmlTextReaderPtr reader = null;
xmlChar *attribVal = null;
//blah...
if (xmlTextReaderAttributeCount(reader) > 0) {
free((attribVal));
attribVal = xmlTextReaderGetAttribute(reader, (const xmlChar*)"super-Attrib");
if (xmlStrcasecmp(attribVal, (const xmlChar*)"monoMega-Attrib") == 0) {
free((attribVal));
my project is in C++ but the libxml2 and all examples from xmlsoft.org use standard C.
Use
xmlFree()instead offree()directly: