[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[xml] xml memory mutex memory leak
- From: Dave Beckett <dave beckett bristol ac uk>
- To: xml gnome org
- Subject: [xml] xml memory mutex memory leak
- Date: Mon, 29 Dec 2003 21:46:30 +0000
This trival program leaks the mutex allocated by xmlInitMemory
in 2.6.3 / CVS head.
cat > t.c
main() {
xmlInitParser();
xmlCleanupParser();
}
$ gcc -o t `xml2-config --libs` t.c
$ valgrind --show-reachable=yes --leak-check=yes -v ./t
...
==25421== 24 bytes in 1 blocks are still reachable in loss record 1 of 2
==25421== at 0x4002CBEE: malloc (vg_replace_malloc.c:160)
==25421== by 0x402DC782: xmlNewMutex (in /usr/lib/libxml2.so.2.6.3)
==25421== by 0x4029D28D: xmlInitMemory (in /usr/lib/libxml2.so.2.6.3)
==25421== by 0x4028AC49: xmlInitParser (in /usr/lib/libxml2.so.2.6.3)
...
(and similarly with CVS head compiled)
The cause was the change in CVS 1.46 of xmlmemory.c
* xmlmemory.c: enhanced by adding mutex to protect global
structures in a multi-threading environment. This fixed
some random errors on the Threads regression tests.
which didn't add a dealloc routine.
Patch to fix attached.
Dave
Index: parser.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/parser.c,v
retrieving revision 1.353
diff -r1.353 parser.c
12114a12115
> xmlCleanupMemory();
Index: xmlmemory.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/xmlmemory.c,v
retrieving revision 1.46
diff -r1.46 xmlmemory.c
814a815,828
> * xmlCleanupMemory:
> *
> * Free up all the memory associated with memorys
> */
> void
> xmlCleanupMemory(void) {
> if (xmlMemInitialized == 0)
> return;
>
> xmlFreeMutex(xmlMemMutex);
> xmlMemInitialized = 0;
> }
>
> /**
Index: include/libxml/xmlmemory.h
===================================================================
RCS file: /cvs/gnome/gnome-xml/include/libxml/xmlmemory.h,v
retrieving revision 1.35
diff -r1.35 xmlmemory.h
131a132,136
> /*
> * Cleanup of the memory layer.
> */
> XMLPUBFUN void XMLCALL
> xmlCleanupMemory (void);
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]