From: Jim Meyering Date: Mon, 17 May 2010 17:28:44 +0000 (+0200) Subject: qemudDomainSetVcpus: avoid NULL-deref on failed uuid look-up X-Git-Tag: v0.8.2~262 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20701b17e22e55a93d7aa94ea2611a58b1f27c04;p=thirdparty%2Flibvirt.git qemudDomainSetVcpus: avoid NULL-deref on failed uuid look-up * src/qemu/qemu_driver.c (qemudDomainSetVcpus): Upon look-up failure, i.e., vm==NULL, goto cleanup, rather than to "endjob", superficially since the latter would dereference vm, but more fundamentally because we certainly don't want to call qemuDomainObjEndJob before we've even attempted qemuDomainObjBeginJob. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 3eb942c6ac..948ab5b417 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5530,7 +5530,7 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { virUUIDFormat(dom->uuid, uuidstr); qemuReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s'"), uuidstr); - goto endjob; + goto cleanup; } if (qemuDomainObjBeginJob(vm) < 0)