After we started copying the privateData pointer in
qemuDomainObjRestoreJob, we should also free them
once we're done with them.
Register the clear function and use g_auto.
Also add a check for job->cb to qemuDomainObjClearJob,
to prevent freeing an uninitialized job.
https://bugzilla.redhat.com/show_bug.cgi?id=
1878450
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: aca37c3fb2e8d733c2788ca4b796c153ea7ce391
void
qemuDomainObjClearJob(qemuDomainJobObjPtr job)
{
+ if (!job->cb)
+ return;
+
qemuDomainObjResetJob(job);
qemuDomainObjResetAsyncJob(job);
g_clear_pointer(&job->privateData, job->cb->freeJobPrivate);
bool qemuDomainTrackJob(qemuDomainJob job);
void qemuDomainObjClearJob(qemuDomainJobObjPtr job);
+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(qemuDomainJobObj, qemuDomainObjClearJob);
int
qemuDomainObjInitJob(qemuDomainJobObjPtr job,
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;