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

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

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]