[PATCH 3/3] qemuBlockJobRefreshJobs: Warn readers that 'job' may be invalid after update

Peter Krempa pkrempa at redhat.com
Thu Mar 26 12:39:41 UTC 2020


Add a comment noting that job update can cause the pointer to be invalid
and thus should not be accessed after.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_blockjob.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 6576f8721f..2032c0c1c5 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -571,6 +571,7 @@ qemuBlockJobRefreshJobs(virQEMUDriverPtr driver,

         if (job->newstate != -1)
             qemuBlockJobUpdate(vm, job, QEMU_ASYNC_JOB_NONE);
+        /* 'job' may be invalid after this update */
     }

     /* remove data for job which qemu didn't report (the algorithm is
-- 
2.24.1




More information about the libvir-list mailing list