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

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



On 08/06/2012 05:52 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange 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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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