mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemu: domainjob: Allow InitJob if cb is not set in qemuDomainObjInitJob()
This allows init job even if cb structure is not set. This patch also includes slight rewriting of the function to make it look cleaner when freeing resources, by allocating privateData at the end. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
965f872f92
commit
e5c10018c5
@ -189,17 +189,18 @@ qemuDomainObjInitJob(qemuDomainJobObj *job,
|
||||
memset(job, 0, sizeof(*job));
|
||||
job->cb = cb;
|
||||
|
||||
if (!(job->privateData = job->cb->allocJobPrivate()))
|
||||
if (virCondInit(&job->cond) < 0)
|
||||
return -1;
|
||||
|
||||
if (virCondInit(&job->cond) < 0) {
|
||||
job->cb->freeJobPrivate(job->privateData);
|
||||
if (virCondInit(&job->asyncCond) < 0) {
|
||||
virCondDestroy(&job->cond);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virCondInit(&job->asyncCond) < 0) {
|
||||
job->cb->freeJobPrivate(job->privateData);
|
||||
if (job->cb &&
|
||||
!(job->privateData = job->cb->allocJobPrivate())) {
|
||||
virCondDestroy(&job->cond);
|
||||
virCondDestroy(&job->asyncCond);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user