Catch execution paths where qemuProcessFree is called before
qemuProcessStopQmp then report error and force stop before proceeding.
Also added public function header and debug message.
Signed-off-by: Chris Venteicher <cventeic(a)redhat.com>
---
src/qemu/qemu_process.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index cb2902be02..9d3ce4eb6d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8075,15 +8075,28 @@ static qemuMonitorCallbacks callbacks = {
};
-
-
+/**
+ * qemuProcessFree:
+ * @proc: Stores Process and Connection State
+ *
+ * Free process data structure.
+ */
void
qemuProcessFree(qemuProcessPtr proc)
{
+ VIR_DEBUG("proc=%p, proc->mon=%p", proc, (proc ? proc->mon : NULL));
+
if (!proc)
return;
- qemuProcessStopQmp(proc);
+ /* This should never be non-NULL if we get here, but just in case... */
+ if (proc->mon || proc->pid) {
+ VIR_ERROR(_("Unexpected QEMU still active during process free"
+ " emulator: %s, pid: %lld, mon: %p"),
+ NULLSTR(proc->binary), (long long) proc->pid, proc->mon);
+ qemuProcessStopQmp(proc);
+ }
+
VIR_FREE(proc->binary);
VIR_FREE(proc->libDir);
VIR_FREE(proc->monpath);
--
2.17.1