[xml] valgrind errrors with this small sample program



Hello!

The following sample program (uses xmlParseMemory() to parse an XML
document) causes many errors in valgrind to appear. I used the latest libxml2
version (2.6.7) compiled from source on a Debian 3.0 "Woody" system (kernel
2.4.23, glibc 2.2.5, gcc 2.95.4). The same example works without any problems
for other XML documents. Could anybody please tell me whether this is a bug
or not? (I'm kind of puzzled. The document is output correctly by
xmlDocDump(), though. But the valgrind errors seem somewhat serious to me.)

The output from valgrind is attached in gzip format.

Thanks in advance for any info on this issue!

Greetings,

        Holger

--------------------------------------------------------------------

#include <stdio.h>
#include <libxml/tree.h>

int main( void )
{
  xmlDocPtr curDoc = NULL;  
  const char* xml_cmds[] = {
   "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><ino:response 
xmlns:ino=\"http://namespaces.softwareag.com/tamino/response2\"; xmlns:xql=\"http://metalab.unc.edu/xql/\"; 
ino:sessionid=\"556\" ino:sessionkey=\"1590469677\"><xql:query>/bsk:DocPart[ 
docId=&apos;20040308152601345236&apos; and @docPartNo=1]</xql:query><ino:message 
ino:returnvalue=\"0\"><ino:messageline>XQL Request 
processing</ino:messageline></ino:message><xql:result><bsk:DocPart docId=\"20040308152601345236\" 
docPartNo=\"1\" ino:id=\"15290\" xmlns:bsk=\"http://www.heitec.net/sara4/tamino/basket\";><bsk:File 
name=\"4898WPZEO2M65\" size=\"75195\"></bsk:File></bsk:DocPart></xql:result><ino:message 
ino:returnvalue=\"0\"><ino:messageline>XQL Request processed</ino:messageline></ino:message></ino:response>",
   NULL
  };

  /* This is a real XML document since it contains an XML declaration */
  curDoc = xmlParseMemory( xml_cmds[0], strlen( xml_cmds[0] ) );
  if ( curDoc ) {
    printf( "curDoc:\n" );
    xmlDocDump( stdout, curDoc );
  }
  if ( curDoc ) xmlFreeDoc( curDoc );
  return EXIT_SUCCESS;
}

Attachment: valgrind.out.gz
Description: Binary data



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