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:
Peter Krempa 2011-11-23 15:51:28 +01:00
parent db2f680775
commit c4b32641f1
1 changed files with 5 additions and 1 deletions

View File

@ -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)