mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Allow caps to be NULL when creating virDomainObjPtr instances
If no private data needs to be maintained, it can be useful to create virDomainObjPtr instances without having a virCapsPtr instance around. Adapt the virDomainObjNew() function to allow for a NULL caps Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
985a321ac0
commit
f4780c12dc
@ -1732,12 +1732,14 @@ virDomainObjPtr virDomainObjNew(virCapsPtr caps)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (caps->privateDataAllocFunc &&
|
||||
!(domain->privateData = (caps->privateDataAllocFunc)())) {
|
||||
virReportOOMError();
|
||||
goto error;
|
||||
if (caps &&
|
||||
caps->privateDataAllocFunc) {
|
||||
if (!(domain->privateData = (caps->privateDataAllocFunc)())) {
|
||||
virReportOOMError();
|
||||
goto error;
|
||||
}
|
||||
domain->privateDataFreeFunc = caps->privateDataFreeFunc;
|
||||
}
|
||||
domain->privateDataFreeFunc = caps->privateDataFreeFunc;
|
||||
|
||||
if (!(domain->snapshots = virDomainSnapshotObjListNew()))
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user