mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 05:17:59 +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
|
void
|
||||||
qemuDomainObjClearJob(qemuDomainJobObjPtr job)
|
qemuDomainObjClearJob(qemuDomainJobObjPtr job)
|
||||||
{
|
{
|
||||||
|
if (!job->cb)
|
||||||
|
return;
|
||||||
|
|
||||||
qemuDomainObjResetJob(job);
|
qemuDomainObjResetJob(job);
|
||||||
qemuDomainObjResetAsyncJob(job);
|
qemuDomainObjResetAsyncJob(job);
|
||||||
g_clear_pointer(&job->privateData, job->cb->freeJobPrivate);
|
g_clear_pointer(&job->privateData, job->cb->freeJobPrivate);
|
||||||
|
@ -275,6 +275,7 @@ int qemuDomainJobInfoToParams(qemuDomainJobInfoPtr jobInfo,
|
|||||||
bool qemuDomainTrackJob(qemuDomainJob job);
|
bool qemuDomainTrackJob(qemuDomainJob job);
|
||||||
|
|
||||||
void qemuDomainObjClearJob(qemuDomainJobObjPtr job);
|
void qemuDomainObjClearJob(qemuDomainJobObjPtr job);
|
||||||
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(qemuDomainJobObj, qemuDomainObjClearJob);
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuDomainObjInitJob(qemuDomainJobObjPtr job,
|
qemuDomainObjInitJob(qemuDomainJobObjPtr job,
|
||||||
|
@ -8081,7 +8081,9 @@ qemuProcessReconnect(void *opaque)
|
|||||||
virQEMUDriverPtr driver = data->driver;
|
virQEMUDriverPtr driver = data->driver;
|
||||||
virDomainObjPtr obj = data->obj;
|
virDomainObjPtr obj = data->obj;
|
||||||
qemuDomainObjPrivatePtr priv;
|
qemuDomainObjPrivatePtr priv;
|
||||||
qemuDomainJobObj oldjob;
|
g_auto(qemuDomainJobObj) oldjob = {
|
||||||
|
.cb = NULL,
|
||||||
|
};
|
||||||
int state;
|
int state;
|
||||||
int reason;
|
int reason;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
g_autoptr(virQEMUDriverConfig) cfg = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user