[libvirt] [PATCH v3 02/10] Convert public datatypes to inherit from virObject

Eric Blake eblake at redhat.com
Mon Aug 6 16:57:41 UTC 2012


On 08/06/2012 05:52 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> This converts the following public API datatypes to use the
> virObject infrastructure:
> 

>  /**
> - * virReleaseConnect:
> + * virConnectDispose:
>   * @conn: the hypervisor connection to release
>   *
>   * Unconditionally release all memory associated with a connection.
> @@ -90,13 +124,9 @@ failed:
>   * be used once this method returns.
>   */
>  static void
> -virReleaseConnect(virConnectPtr conn) {
> -    VIR_DEBUG("release connection %p", conn);
> -
> -    /* make sure to release the connection lock before we call the
> -     * close callbacks, otherwise we will deadlock if an error
> -     * is raised by any of the callbacks */
> -    virMutexUnlock(&conn->lock);
> +virConnectDispose(void *obj)
> +{
> +    virConnectPtr conn = obj;
>  
>      if (conn->networkDriver)
>          conn->networkDriver->close(conn);
> @@ -127,35 +157,6 @@ virReleaseConnect(virConnectPtr conn) {
>      VIR_FREE(conn);

Ouch.  I missed this bug, which causes 'make check' to segfault due to a
double-free of each virConnectPtr.  Squash this in.

diff --git i/src/datatypes.c w/src/datatypes.c
index e827c2d..d65eec0 100644
--- i/src/datatypes.c
+++ w/src/datatypes.c
@@ -154,7 +154,6 @@ virConnectDispose(void *obj)

     virMutexUnlock(&conn->lock);
     virMutexDestroy(&conn->lock);
-    VIR_FREE(conn);
 }

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

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


More information about the libvir-list mailing list