[xml] Crash on xmlMalloc



Hi all,

I'm developing an application using the library libxml2.
It seams that all was ok but yesterday my application crashed for an unknown reason.
I tried to debug and after some work I found that the line where my application crash is the xmlMalloc in the xmlParserCtxtPtr !

I'm using the libxml2 version 2.7.6 
I'm using the autotools 

=> In the file configure.ac :
# libxml2
PKG_CHECK_MODULES(LIBXMLDEPS, libxml-2.0 >= 2.6.8)
AC_SUBST(LIBXMLDEPS_CFLAGS)

=> In the file makefile.am :
libmxml_la_CPPFLAGS = -Iinclude $(LIBXMLDEPS_CFLAGS) -D_GNU_SOURCE

This is the back-trace :

*** glibc detected *** /home/mine/buildSVNLocal/web/cgi/config_etat.cgi: malloc(): memory corruption: 0x08052840 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x55f591]
/lib/tls/i686/cmov/libc.so.6(+0x6e395)[0x562395]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x5c)[0x563f9c]
/usr/lib/libxml2.so.2(xmlNewParserCtxt+0x29)[0x3a02d9]
/usr/lib/libxml2.so.2(xmlCreateMemoryParserCtxt+0x34)[0x3a3d94]
/usr/lib/libxml2.so.2(xmlSAXParseMemoryWithData+0x34)[0x3bae74]
/usr/lib/libxml2.so.2(xmlSAXParseMemory+0x2e)[0x3baf3e]
/usr/lib/libxml2.so.2(xmlParseMemory+0x28)[0x3baf98]
/home/mine/local/lib/libmxml.so.1(raw_parse_buffer+0x93)[0x15dd0a] //I call here xmlParseMemory

This is the function :

xmlParserCtxtPtr xmlNewParserCtxt(void)
{
    xmlParserCtxtPtr ctxt;

    ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt));
    if (ctxt == NULL) {                                                                   //<- Never see this line !!!
xmlErrMemory(NULL, "cannot allocate parser context\n");
return(NULL);
    }
    memset(ctxt, 0, sizeof(xmlParserCtxt));
    if (xmlInitParserCtxt(ctxt) < 0) {
        xmlFreeParserCtxt(ctxt);
return(NULL);
    }
    return(ctxt);
}

With a google search I saw some errors with xmlMalloc but not in the same context that mine.
Do you have any ideas ? I need your help.

Thanks


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