[libvirt] [PATCH 2/3] Initialize and destroy pthread condition variable for _virStoragePoolObj

Guannan Ren gren at redhat.com
Sun Jul 10 14:29:04 UTC 2011


---
 src/conf/storage_conf.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index f6f8be1..0279850 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -323,6 +323,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj) {
     VIR_FREE(obj->autostartLink);
 
     virMutexDestroy(&obj->lock);
+    ignore_value(virCondDestroy(&obj->cond));
 
     VIR_FREE(obj);
 }
@@ -1391,6 +1392,15 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
         VIR_FREE(pool);
         return NULL;
     }
+
+    if (virCondInit(&pool->cond) < 0) {
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                              "%s", _("cannot initialize cond"));
+        virMutexDestroy(&pool->lock);
+        VIR_FREE(pool);
+        return NULL;
+    }
+
     virStoragePoolObjLock(pool);
     pool->active = 0;
     pool->def = def;
-- 
1.7.1




More information about the libvir-list mailing list