[xml] XPath memory leak

This XPath causes a memory leak in the current libxml2 (version 2.7.7):


It should be possible to reproduce it by calling the xpath1.c example program like with these arguments:

  xpath1 AnyFile.xml //nr:one/nr:/nr:two/*

This is the call stack:

The memory block (0x00D06B60) [size: 3 bytes] was allocated with malloc
    0x00440619 - xmlstring.c#45
    0x00425DD3 - xpath.c#9751
    0x0042D7C6 - xpath.c#11228
    0x0042E36A - xpath.c#11348
    0x0042E70A - xpath.c#11387
    0x00429B10 - xpath.c#10586

The leak is caused by the fact that CHECK_ERROR in xpath.c, line 11252, simply returns and does not free the memory allocated to name in line 11228:

  name = xmlXPathParseNCName(ctxt);

A fix should be fairly simple.


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