Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 112098 - memory leak in libxml2 2.6.22 [maybe others] (according to valgrind)
Summary: memory leak in libxml2 2.6.22 [maybe others] (according to valgrind)
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-10 12:25 UTC by Cody
Modified: 2005-11-10 13:13 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
code that demonstrates the problem (valtest.c,454 bytes, application/octet-stream)
2005-11-10 12:30 UTC, Cody
Details
file I passed to the program ... (test.xml,29 bytes, text/xml)
2005-11-10 12:32 UTC, Cody
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cody 2005-11-10 12:25:47 UTC
Not sure if this is a problem in Valgrind, or libxml2 (or even something else),
but this program (will attach in a moment) is reported as having a memory leak.
Valgrind says it's still reachable, but passing --show-reachable=yes does not
show anything else. The program seems to free all allocated memory, so I'm
guessing the problem is in libxml2 (but don't have any way to confirm that).


Reproducible: Always
Steps to Reproduce:
1. emerge valgrind and emerge libxml2 if not already emerged

2. Compile the program (making sure to specify -I/usr/include/libxml2 -lxml2 and
perhaps -g -ggdb3)

3. Run the program with valgrind on the test xml file (valgrind ./testval
test.xml for example)


Actual Results:  
Valgrind will display that there is a leak in the program.

Expected Results:  
Valgrind shouldn't find a leak.

Valgrind version: 2.4.0
Libxml2 version: 2.6.22

Emerge info:
Portage 2.0.51.22-r3 (default-linux/x86/2005.1, gcc-3.3.6, glibc-2.3.5-r2,
2.6.12-gentoo-r10 i686)
=================================================================
System uname: 2.6.12-gentoo-r10 i686 AMD Athlon(tm) 
Gentoo Base System version 1.6.13
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
dev-lang/python:     2.3.5-r2, 2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.15.92.0.2-r10
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=i686 -mcpu=athlon-mp -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=i686 -mcpu=athlon-mp -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 alsa apm arts avi berkdb bitmap-fonts boundschecking bzip2 crypt cscope
cups eds emboss encode expat foomaticdb fortran gdbm gif gpm gstreamer gtk2 idn
imlib ipv6 jpeg kde libg++ libwww mad mikmod motif mp3 mpeg ncurses nls ogg
oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl spell ssl
tcpd truetype truetype-fonts type1-fonts udev vorbis xml2 xmms xv zlib
userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 1 Cody 2005-11-10 12:30:47 UTC
Created attachment 72591 [details]
code that demonstrates the problem

I compiled this with:

gcc -Wall -g -ggdb3 -o valtest valtest.c -I/usr/include/libxml2 -lxml2

Then ran it with:

valgrind ./valtest test.xml
Comment 2 Cody 2005-11-10 12:32:23 UTC
Created attachment 72592 [details]
file I passed to the program ...
Comment 3 Marien Zwart (RETIRED) gentoo-dev 2005-11-10 12:52:03 UTC
Calling xmlCleanupParser after xmlFreeDoc makes valgrind stop complaining here.
Comment 4 Daniel Gryniewicz (RETIRED) gentoo-dev 2005-11-10 13:01:26 UTC
Sounds like a bug in the test program?  If not, re-open.
Comment 5 Cody 2005-11-10 13:13:46 UTC
(In reply to comment #4)
> Sounds like a bug in the test program?  If not, re-open.

I suppose it could be marked closed then.

Tested and all is good with that function. Not sure why I didn't notice this
before though (I could have sworn it never did this in the past). Is this new or
did it do it before and I was blind ?

Thanks though. Works for me.