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