Re: [xml] Crash on xmlMalloc

On Thu, Sep 09, 2010 at 11:03:45AM +0200, IMS wrote:
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
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 :
*# libxml2*
*PKG_CHECK_MODULES(LIBXMLDEPS, libxml-2.0 >= 2.6.8)*

=> In the file :

This is the back-trace :

*** glibc detected *** /home/mine/buildSVNLocal/web/cgi/config_etat.cgi:
malloc(): memory corruption: 0x08052840 ***
======= Backtrace: =========
/home/mine/local/lib/[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");
    memset(ctxt, 0, sizeof(xmlParserCtxt));
    if (xmlInitParserCtxt(ctxt) < 0) {

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.

  Some of the code of the application is corrupting memory, it happen to
corrupt the memory allocation area managed by glibc, and glibc notices
during an allocation from libxml2 but the corruption was done earlier.
Use valgrind to track this down. Don't assume the problem is in other
people code,


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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