diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index e5910a11a1..3c2c6b9179 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -248,6 +248,9 @@ qemuDomainObjRestoreJob(virDomainObjPtr obj, void qemuDomainObjClearJob(qemuDomainJobObjPtr job) { + if (!job->cb) + return; + qemuDomainObjResetJob(job); qemuDomainObjResetAsyncJob(job); g_clear_pointer(&job->privateData, job->cb->freeJobPrivate); diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index eedd84c503..79f0127252 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -275,6 +275,7 @@ int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo, bool qemuDomainTrackJob(qemuDomainJob job); void qemuDomainObjClearJob(qemuDomainJobObjPtr job); +G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(qemuDomainJobObj, qemuDomainObjClearJob); int qemuDomainObjInitJob(qemuDomainJobObjPtr job, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b1af35b933..073b2d96e0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8081,7 +8081,9 @@ qemuProcessReconnect(void *opaque) virQEMUDriverPtr driver = data->driver; virDomainObjPtr obj = data->obj; qemuDomainObjPrivatePtr priv; - qemuDomainJobObj oldjob; + g_auto(qemuDomainJobObj) oldjob = { + .cb = NULL, + }; int state; int reason; g_autoptr(virQEMUDriverConfig) cfg = NULL;