]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Remove possible NULL deref in debug output
authorJohn Ferlan <jferlan@redhat.com>
Wed, 24 Sep 2014 12:30:09 +0000 (08:30 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 6 Oct 2014 14:35:26 +0000 (10:35 -0400)
Check for !dev->info.alias was done after a VIR_DEBUG() statement
that already tried to print - just flip sequence

src/qemu/qemu_hotplug.c

index bc683e036af1b2d1caaa36b2b831d0aec179a95a..1e504ec591bc98dd0f6333abc98c43f1859c4098 100644 (file)
@@ -1887,14 +1887,14 @@ int qemuDomainChangeNetLinkState(virQEMUDriverPtr driver,
     int ret = -1;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate);
-
     if (!dev->info.alias) {
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("can't change link state: device alias not found"));
         return -1;
     }
 
+    VIR_DEBUG("dev: %s, state: %d", dev->info.alias, linkstate);
+
     qemuDomainObjEnterMonitor(driver, vm);
 
     ret = qemuMonitorSetLink(priv->mon, dev->info.alias, linkstate);