mirror of https://gitee.com/openkylin/libvirt.git
qemu: Avoid dereference of NULL pointer
If something fails while initializing qemu job object in qemuDomainObjPrivateAlloc(), memory to the private pointer is freed, but after that, the pointer is still dereferenced, which may result in a segfault. * qemuDomainObjPrivateAlloc() - Don't dereference NULL pointer.
This commit is contained in:
parent
db2f680775
commit
c4b32641f1
|
@ -214,11 +214,15 @@ static void *qemuDomainObjPrivateAlloc(void)
|
|||
return NULL;
|
||||
|
||||
if (qemuDomainObjInitJob(priv) < 0)
|
||||
VIR_FREE(priv);
|
||||
goto error;
|
||||
|
||||
priv->migMaxBandwidth = QEMU_DOMAIN_DEFAULT_MIG_BANDWIDTH_MAX;
|
||||
|
||||
return priv;
|
||||
|
||||
error:
|
||||
VIR_FREE(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void qemuDomainObjPrivateFree(void *data)
|
||||
|
|
Loading…
Reference in New Issue