From 2624c6d2d2be96a94c1678b83fde407ffb3aa49f Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 26 Nov 2019 13:39:18 +0100 Subject: [PATCH] qemu: blockjob: Separate clearing of per-job data We will need to clear per-job type data when we will be marking a blockjob as broken in the new way. Extract the code for future reuse. Signed-off-by: Peter Krempa Reviewed-by: Cole Robinson --- src/qemu/qemu_blockjob.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 5a6c5542a6..9148e40ce5 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -71,6 +71,14 @@ VIR_ENUM_IMPL(qemuBlockjob, static virClassPtr qemuBlockJobDataClass; +static void +qemuBlockJobDataDisposeJobdata(qemuBlockJobDataPtr job) +{ + if (job->type == QEMU_BLOCKJOB_TYPE_CREATE) + virObjectUnref(job->data.create.src); +} + + static void qemuBlockJobDataDispose(void *obj) { @@ -79,8 +87,7 @@ qemuBlockJobDataDispose(void *obj) virObjectUnref(job->chain); virObjectUnref(job->mirrorChain); - if (job->type == QEMU_BLOCKJOB_TYPE_CREATE) - virObjectUnref(job->data.create.src); + qemuBlockJobDataDisposeJobdata(job); g_free(job->name); g_free(job->errmsg); -- GitLab