[libvirt] [PATCH 08/10] Ensure transient def is removed if LXC start fails

Daniel P. Berrange berrange at redhat.com
Tue Nov 27 17:06:27 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

When starting a container, newDef is initialized to a
copy of 'def', but when startup fails newDef is never
removed. This cause later attempts to use 'virDomainDefine'
to loose the new data being defined.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/lxc/lxc_process.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 6cfbb0d..28eecec 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1199,6 +1199,10 @@ cleanup:
         VIR_FREE(veths[i]);
     }
     if (rc != 0) {
+        if (vm->newDef) {
+            virDomainDefFree(vm->newDef);
+            vm->newDef = NULL;
+        }
         if (priv->monitor) {
             virObjectUnref(priv->monitor);
             priv->monitor = NULL;
-- 
1.7.11.2




More information about the libvir-list mailing list