libxl: unref DomainObjPrivate on error path

There is a potential leak of a newly created libxlDomainObjPrivate
when subsequent allocation of the object's chrdev field fails.
Unref the object on such an error so that it is properly disposed.
This commit is contained in:
Jim Fehlig 2013-08-15 10:03:17 -06:00
parent 5075248ac9
commit f0c513a6a0

View File

@ -454,8 +454,10 @@ libxlDomainObjPrivateAlloc(void)
if (!(priv = virObjectLockableNew(libxlDomainObjPrivateClass)))
return NULL;
if (!(priv->devs = virChrdevAlloc()))
if (!(priv->devs = virChrdevAlloc())) {
virObjectUnref(priv);
return NULL;
}
return priv;
}