[xml] xml memory mutex memory leak

This trival program leaks the mutex allocated by xmlInitMemory
in 2.6.3 / CVS head.

cat > t.c
main() {
$ 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.


Attachment: xmlmemory-mutex.patch
Description: Text document

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