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

Re: [libvirt] [PATCH 1/3] libvirt: Increase connection reference count for callbacks

On 03/26/13 10:54, Viktor Mihajlovski wrote:
By adjusting the reference count of the connection object we
prevent races between callback function and virConnectClose.

Hum. Here I agree that this is definitely possible (and I managed to reproduce the invalid read and possible memory corruption) but I don't completely like the fix here.

As the callback is called at a moment when the connection won't be usable anymore I think that the callback should automatically unregister itself and also clear the opaque data if that is requested. (Which isn't done right now if the caller doesn't unregister it).

With automatic unregistration we save a lot of hassle, and also avoid the need of hackery that you needed to add in the 3/3 patch to avoid leaking the reference. I also think that the virConnectClose function should automatically get rid of the callback if the caller doesn't do it before.

Dan, any ideas on this?


P.S.: This should be fixed before the release.

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