[libvirt] [PATCH 2/2] Fix reference handling leak on qemuMonitor

Eric Blake eblake at redhat.com
Thu Jun 10 14:39:07 UTC 2010


On 06/10/2010 08:17 AM, Daniel P. Berrange wrote:
> The current code pattern requires that callers of qemuMonitorClose
> check for the return value == 0, and if so, set priv->mon = NULL
> and release the reference held on the associated virDomainObjPtr
> 
> The change d84bb6d6a3bd2fdd530184cc9743249ebddbee71 violated that
> requirement, meaning that priv->mon never gets set to NULL, and
> a reference count is leaked on virDomainObjPtr.
> 
> This design was a bad one, so remove the need to check the return
> valueof qemuMonitorClose(). Instead allow registration of a
> callback that's invoked just when the last reference on qemuMonitorPtr
> is released.
> 
> Finally there was a potential reference leak in qemuConnectMonitor
> in the failure path.

Definitely worth cleaning up.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100610/078bb36a/attachment-0001.sig>


More information about the libvir-list mailing list