mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
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:
parent
5075248ac9
commit
f0c513a6a0
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user