mirror of https://gitee.com/openkylin/libvirt.git
virdomainjob: check if cb is not NULL before dereferencing
The callback struct does not always have to be set which could cause a dereferencing of a NULL pointer. This patch adds check against NULL in missing places before dereferencing. Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3478cca80e
commit
39e98f4113
|
@ -626,7 +626,7 @@ virDomainObjEndJob(virDomainObj *obj)
|
|||
|
||||
virDomainObjResetJob(obj->job);
|
||||
|
||||
if (virDomainTrackJob(job) &&
|
||||
if (virDomainTrackJob(job) && obj->job->cb &&
|
||||
obj->job->cb->saveStatusPrivate)
|
||||
obj->job->cb->saveStatusPrivate(obj);
|
||||
/* We indeed need to wake up ALL threads waiting because
|
||||
|
@ -662,7 +662,7 @@ virDomainObjEndAsyncJob(virDomainObj *obj)
|
|||
obj, obj->def->name);
|
||||
|
||||
virDomainObjResetAsyncJob(obj->job);
|
||||
if (obj->job->cb->saveStatusPrivate)
|
||||
if (obj->job->cb && obj->job->cb->saveStatusPrivate)
|
||||
obj->job->cb->saveStatusPrivate(obj);
|
||||
virCondBroadcast(&obj->job->asyncCond);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue