Re: [xml] XPath memory leak
- From: Daniel Veillard <veillard redhat com>
- To: Ralf Junker <ralfjunker gmx de>
- Cc: "xml gnome org" <xml gnome org>
- Subject: Re: [xml] XPath memory leak
- Date: Fri, 15 Oct 2010 18:33:03 +0200
On Sun, Jun 13, 2010 at 06:03:44PM +0200, Ralf Junker wrote:
This XPath causes a memory leak in the current libxml2 (version 2.7.7):
//nr:one/nr:/nr:two/*
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.
Thanks Ralf,
sorry it took me a while to look at it, but confirmed, there is a leak,
so I made the simple fix needed and commited it to git,
thanks again !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]