提交 8881ae1b 编写于 作者: M Mark McLoughlin

Fix net/disk hot-unplug segfault

When we hot-unplug the last device, we're currently double-freeing
the device definition.

Reported by Martin Banas here:

  https://bugzilla.redhat.com/523953

* src/qemu_driver.c: fix double free
上级 3c80fac2
...@@ -5998,7 +5998,7 @@ try_command: ...@@ -5998,7 +5998,7 @@ try_command:
/* ignore, harmless */ /* ignore, harmless */
} }
} else { } else {
VIR_FREE(vm->def->disks[0]); VIR_FREE(vm->def->disks);
vm->def->ndisks = 0; vm->def->ndisks = 0;
} }
virDomainDiskDefFree(detach); virDomainDiskDefFree(detach);
...@@ -6100,7 +6100,7 @@ qemudDomainDetachNetDevice(virConnectPtr conn, ...@@ -6100,7 +6100,7 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
/* ignore, harmless */ /* ignore, harmless */
} }
} else { } else {
VIR_FREE(vm->def->nets[0]); VIR_FREE(vm->def->nets);
vm->def->nnets = 0; vm->def->nnets = 0;
} }
virDomainNetDefFree(detach); virDomainNetDefFree(detach);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册