diff options
author | Jim Meyering <meyering@redhat.com> | 2010-05-14 12:38:43 +0200 |
---|---|---|
committer | Doug Goldstein <cardoe@gentoo.org> | 2010-05-26 11:57:01 -0500 |
commit | 74eabfd8d27d4a788c32da5290b467af095462ed (patch) | |
tree | ef2b54f0c358f7fca292203e28cc7ebbbddef5fa | |
parent | cgroup: Fix possible memory leak in virCgroupMakeGroup (diff) | |
download | libvirt-74eabfd8d27d4a788c32da5290b467af095462ed.tar.gz libvirt-74eabfd8d27d4a788c32da5290b467af095462ed.tar.bz2 libvirt-74eabfd8d27d4a788c32da5290b467af095462ed.zip |
qemudDomainSetVcpus: avoid NULL-deref
* src/qemu/qemu_driver.c (qemudDomainSetVcpus): Avoid NULL-deref
upon unknown UUID. Call qemuDomainObjBeginJob(vm) only after
ensuring that vm != NULL, not before. This potential NULL-deref
was introduced by commit 2c555d87b0041e0d1ec4742386d2161d1b2f0600.
-rw-r--r-- | src/qemu/qemu_driver.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5db2f596d..1c50be984 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5406,9 +5406,6 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { vm = virDomainFindByUUID(&driver->domains, dom->uuid); qemuDriverUnlock(driver); - if (qemuDomainObjBeginJob(vm) < 0) - goto cleanup; - if (!vm) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virUUIDFormat(dom->uuid, uuidstr); @@ -5417,6 +5414,9 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { goto endjob; } + if (qemuDomainObjBeginJob(vm) < 0) + goto cleanup; + if (!virDomainObjIsActive(vm)) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); |