
On Tue, 2016-10-11 at 16:22 +0200, Martin Kletzander wrote:
On Wed, Sep 28, 2016 at 01:41:35PM -0400, Dawid Zamirski wrote:
* _pfnUnitilalize decrements connectionCount in g_pVBoxGlobalData and once it is down to 0, it calls pfnComUnitialize and g_pVBoxGlobalData if free'd. This ensures that pfnComInitialize and pfnComUnitialize pair is called only once, even when multiple concurrent connections are in use.
That's not true if there is a connection being made while it is being free()d or it's being allocated in two threads, etc. Unless I missed something, that is.
On a second thought, seeing how both _pfnInitialize and _pfnUnintialize (each called in virConnectOpen/Close respectively) obtain a mutex on g_pVBoxGlobalData, I think my original statement holds true, that is, ignoring the unsafe allocation of the global as you pointed out earlier.