]> xenbits.xensource.com Git - libvirt.git/commit
threads: check for failure to set thread-local value
authorEric Blake <eblake@redhat.com>
Tue, 20 Dec 2011 22:06:47 +0000 (15:06 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 19 Jan 2012 20:14:10 +0000 (13:14 -0700)
commit927cfaf467a1eb5d2a0fea3a262ea9b212440c91
treee24ea5900568835822ad1d4a8eae0d48c8e35f5c
parent91f79d27cc84fdc54961f5d1c6a07159701cb9b2
threads: check for failure to set thread-local value

We had a memory leak on a very arcane OOM situation (unlikely to ever
hit in practice, but who knows if libvirt.so would ever be linked
into some other program that exhausts all thread-local storage keys?).
I found it by code inspection, while analyzing a valgrind report
generated by Alex Jia.

* src/util/threads.h (virThreadLocalSet): Alter signature.
* src/util/threads-pthread.c (virThreadHelper): Reduce allocation
lifetime.
(virThreadLocalSet): Detect failure.
* src/util/threads-win32.c (virThreadLocalSet): Likewise.
(virCondWait): Fix caller.
* src/util/virterror.c (virLastErrorObject): Likewise.
src/util/threads-pthread.c
src/util/threads-win32.c
src/util/threads.h
src/util/virterror.c