]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuProcessHandleMemoryDeviceSizeChange: Use qemuProcessEventSubmit()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 25 Oct 2021 13:14:51 +0000 (15:14 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 26 Oct 2021 08:43:55 +0000 (10:43 +0200)
This is a typical example of what can go wrong when sending out
an old patch. Back in January, when I was writing
qemuProcessHandleMemoryDeviceSizeChange() events were sent to the
worker pool thread using virThreadPoolSendJob(). Then, in July a
helper was introduced (qemuProcessEventSubmit()) but since my
code was not committed and I did not pay attention my code wasn't
updated. Later, when I merged my code it uses the old approach.

BTW: this also fixes a possible double free which I completely
missed when writing the code ~10 months ago.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_process.c

index 2a1fcad1eebea41692f10a983b7c2b8c1536c5c7..d5f8a47ac293795f13746c268bd86c9596849fb0 100644 (file)
@@ -1870,15 +1870,8 @@ qemuProcessHandleMemoryDeviceSizeChange(qemuMonitor *mon G_GNUC_UNUSED,
     processEvent->vm = virObjectRef(vm);
     processEvent->data = g_steal_pointer(&info);
 
-    if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) {
-        qemuProcessEventFree(processEvent);
-        virObjectUnref(vm);
-        goto cleanup;
-    }
+    qemuProcessEventSubmit(driver, &processEvent);
 
-    processEvent = NULL;
- cleanup:
-    qemuProcessEventFree(processEvent);
     virObjectUnlock(vm);
 }