From nobody Thu May 2 09:18:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1487866759002432.5180279469141; Thu, 23 Feb 2017 08:19:19 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NGGJCN018222; Thu, 23 Feb 2017 11:16:19 -0500 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NGFpIG007405 for ; Thu, 23 Feb 2017 11:15:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 01DD5B7D4B; Thu, 23 Feb 2017 16:15:51 +0000 (UTC) Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 538E5B7D3C; Thu, 23 Feb 2017 16:15:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 23 Feb 2017 17:15:47 +0100 Message-Id: X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-loop: libvir-list@redhat.com Cc: mhartmay@linux.vnet.ibm.com Subject: [libvirt] [PATCH] qemuProcessInit: Jump onto correct label in case of error X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" After eca76884ea in case of error in qemuDomainSetPrivatePaths() in pretended start we jump to stop. I've changed this during review from 'cleanup' which turned out to be correct. Well, sort of. We can't call qemuProcessStop() as it decrements driver->nactive and we did not increment it. However, it calls virDomainObjRemoveTransientDef() which is basically the only function we need to call. So call that function and goto cleanup; Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index df1fa0371..9306e0e18 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4758,8 +4758,10 @@ qemuProcessInit(virQEMUDriverPtr driver, goto cleanup; =20 if (flags & VIR_QEMU_PROCESS_START_PRETEND) { - if (qemuDomainSetPrivatePaths(driver, vm) < 0) - goto stop; + if (qemuDomainSetPrivatePaths(driver, vm) < 0) { + virDomainObjRemoveTransientDef(vm); + goto cleanup; + } } else { vm->def->id =3D qemuDriverAllocateID(driver); qemuDomainSetFakeReboot(driver, vm, false); --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list