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

Re: [libvirt] Memory leak in libvirt / gnutls



On 04/07/2012 03:33 AM, Richard W.M. Jones wrote:

> However the above commit is later amended by this commit:
> 
> ----------------------------------------------------------------------
>   commit eaddec976ef06457fee4a4ce86b8c7ee906183b7
>   Author: Michal Privoznik <mprivozn redhat com>
>   Date:   Wed Aug 24 16:16:45 2011 +0200
> 
>     daemon: Move TLS initialization to virInitialize
>     
>     My previous patch 74c75671331d284e1f777f9692b72e9737520bf0
>     introduced a regression by removing TLS initialization from client.
> ----------------------------------------------------------------------
> 
> which removes virNetTLSDeinit.  This appears to be a mistake, or at
> least I can't see the logical reason for it, and according to the
> gnutls docs, it would introduce a memory leak looking exactly like the
> one I am chasing down.

I remember asking at the time, and seem to remember this answer:

gnutls_global_init is not thread-safe, and therefore must not be called
in the context of a library that might be in use by a multi-threaded
parent application.  Same goes for gnutls_global_deinit.  We'd rather
leak the memory (which isn't really a leak unless you dynamically load
and unload libvirt multiple times in your app) than risk thread
unsafety, all while waiting for gnutls to fix their thread-safety issue.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


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