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

Pavel Mores pmores at redhat.com
Thu Apr 2 11:27:44 UTC 2020


On Thu, Mar 26, 2020 at 01:39:41PM +0100, Peter Krempa wrote:
> 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
> 

Reviewed-by: Pavel Mores <pmores at redhat.com>




More information about the libvir-list mailing list