]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Do not release device address on successful RNG attach
authorLuyao Huang <lhuang@redhat.com>
Sun, 31 May 2015 11:29:46 +0000 (19:29 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 2 Jun 2015 18:03:48 +0000 (14:03 -0400)
Commit id '980b265d' neglected to check for a successful status when
deciding whether to release the device address for the RNG attach thus
the address would be released even though the device was added.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
src/qemu/qemu_hotplug.c

index f5967308948963191a1c4377ca781b086020db48..94ebe35ddd285670f104b2d9bdb5198fd37fbddc 100644 (file)
@@ -1695,7 +1695,7 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver,
  audit:
     virDomainAuditRNG(vm, NULL, rng, "attach", ret == 0);
  cleanup:
-    if (vm)
+    if (ret < 0 && vm)
         qemuDomainReleaseDeviceAddress(vm, &rng->info, NULL);
     VIR_FREE(charAlias);
     VIR_FREE(objAlias);