mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemuProcessReconnect: clear 'oldjob'
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: aca37c3fb2
This commit is contained in:
parent
a3c340e05f
commit
af16e754cd
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user