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 <pkrempa(a)redhat.com>
---
src/qemu/qemu_blockjob.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 5a6c5542a6..6db3e0ca84 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -70,6 +70,13 @@ 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 +86,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);
--
2.23.0