]> xenbits.xensource.com Git - libvirt.git/commit
Fix crash when deleting monitor while a command is in progress
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 26 Nov 2009 13:29:29 +0000 (13:29 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 8 Dec 2009 13:46:48 +0000 (13:46 +0000)
commit79533da1b36cc16e0f3f8aea798d6cc20528c451
tree335db95cf01ef73c8032b5b735b977c62401caa9
parent1f60411686b601039ad669f7aa285fa49893ac3d
Fix crash when deleting monitor while a command is in progress

If QEMU shuts down while we're in the middle of processing a
monitor command, the monitor will be freed, and upon cleaning
up we attempt to do  qemuMonitorUnlock(priv->mon) when priv->mon
is NULL.

To address this we introduce proper reference counting into
the qemuMonitorPtr object, and hold an extra reference whenever
executing a command.

* src/qemu/qemu_driver.c: Hold a reference on the monitor while
  executing commands, and only NULL-ify the priv->mon field when
  the last reference is released
* src/qemu/qemu_monitor.h, src/qemu/qemu_monitor.c: Add reference
  counting to handle safe deletion of monitor objects
src/qemu/qemu_driver.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h