]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: Don't crash by forgetting to ref transient domains
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 20 Jul 2016 07:23:03 +0000 (09:23 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Sun, 24 Jul 2016 07:08:20 +0000 (09:08 +0200)
So commit 306b3a8504 tried mimicking behaviour of commit 540c339a25, but
added a virObjectRef(vm) only after virDomainObjListAdd() in
lxcDomainDefineXMLFlags() and not in lxcDomainCreateXMLWithFiles().
That way undefining a domain that was started with different XML than
defined will leave the domain object in a state with not enough
references to then remove it.  Hence any lxcDomainDestroyFlags() called
afterwards crashes the daemon.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1351057

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/lxc/lxc_driver.c

index 46af05d439180f16acb18c688d62b1449a9840a5..2e6788af095220b09ef9553f63659582114811ee 100644 (file)
@@ -1247,6 +1247,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
                                    VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
                                    NULL)))
         goto cleanup;
+    virObjectRef(vm);
     def = NULL;
 
     if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0) {