From ba1072f0aca34dc3158d45f988bfd8a44dfa1f54 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 27 Apr 2010 22:35:32 +0200 Subject: [PATCH] qemuDomainSnapshotCreateXML: avoid NULL dereferences * src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): When setting "vm" to NULL, jump over vm-dereferencing code to "cleanup". (qemuDomainRevertToSnapshot): Likewise. --- src/qemu/qemu_driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cbd6b67c5e..dbc6e2d4b4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10875,8 +10875,10 @@ static virDomainSnapshotPtr qemuDomainSnapshotCreateXML(virDomainPtr domain, qemuDomainObjEnterMonitorWithDriver(driver, vm); ret = qemuMonitorCreateSnapshot(priv->mon, def->name); qemuDomainObjExitMonitorWithDriver(driver, vm); - if (qemuDomainObjEndJob(vm) == 0) + if (qemuDomainObjEndJob(vm) == 0) { vm = NULL; + goto cleanup; + } if (ret < 0) goto cleanup; } @@ -11205,6 +11207,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, if (qemuDomainObjEndJob(vm) > 0) virDomainRemoveInactive(&driver->domains, vm); vm = NULL; + goto cleanup; } } -- GitLab