Use the virDomainDefNew() helper to allocate the definition instead of doing it via VIR_ALLOC. --- src/conf/domain_conf.c | 2 +- src/lxc/lxc_native.c | 2 +- src/openvz/openvz_conf.c | 2 +- src/parallels/parallels_sdk.c | 2 +- src/phyp/phyp_driver.c | 2 +- src/qemu/qemu_command.c | 2 +- src/vbox/vbox_common.c | 8 ++++---- src/vmx/vmx.c | 2 +- src/xenconfig/xen_sxpr.c | 2 +- src/xenconfig/xen_xl.c | 2 +- src/xenconfig/xen_xm.c | 2 +- tests/openvzutilstest.c | 2 +- tests/securityselinuxtest.c | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 420b713..6dea109 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12910,7 +12910,7 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(schema); } - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) return NULL; if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index cd3b86b..99613af 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -1002,7 +1002,7 @@ lxcParseConfigString(const char *config) if (!(properties = virConfReadMem(config, 0, VIR_CONF_FLAG_LXC_FORMAT))) return NULL; - if (VIR_ALLOC(vmdef) < 0) + if (!(vmdef = virDomainDefNew())) goto error; if (virUUIDGenerate(vmdef->uuid) < 0) { diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index f955dda..848e230 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -543,7 +543,7 @@ int openvzLoadDomains(struct openvz_driver *driver) } *line++ = '\0'; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto cleanup; def->virtType = VIR_DOMAIN_VIRT_OPENVZ; diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 8c05b32..d5ea00a 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -1186,7 +1186,7 @@ prlsdkLoadDomain(parallelsConnPtr privconn, virCheckNonNullArgGoto(privconn, error); virCheckNonNullArgGoto(sdkdom, error); - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto error; if (!olddom) { diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index d05f897..d69e29c 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1708,7 +1708,7 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml) virBuffer buf = VIR_BUFFER_INITIALIZER; char *domain_name = NULL; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto cleanup; domain_name = escape_specialcharacters(domain->name); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b6fca9c..8b660f0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11867,7 +11867,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps, return NULL; } - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto error; /* allocate the cmdlinedef up-front; if it's unused, we'll free it later */ diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index deca490..55d3624 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3860,7 +3860,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) if (openSessionForMachine(data, dom->uuid, &iid, &machine, false) < 0) goto cleanup; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto cleanup; gVBoxAPI.UIMachine.GetAccessible(machine, &accessible); @@ -4114,7 +4114,7 @@ static int vboxDomainAttachDeviceImpl(virDomainPtr dom, return ret; VBOX_IID_INITIALIZE(&iid); - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) return ret; if (VIR_STRDUP(def->os.type, "hvm") < 0) @@ -4246,7 +4246,7 @@ static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) return ret; VBOX_IID_INITIALIZE(&iid); - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) return ret; if (VIR_STRDUP(def->os.type, "hvm") < 0) @@ -6032,7 +6032,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot, if (!(snap = vboxDomainSnapshotGet(data, dom, machine, snapshot->name))) goto cleanup; - if (VIR_ALLOC(def) < 0 || VIR_ALLOC(def->dom) < 0) + if (VIR_ALLOC(def) < 0 || !(def->dom = virDomainDefNew())) goto cleanup; if (VIR_STRDUP(def->name, snapshot->name) < 0) goto cleanup; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 2a794c7..ac2542a 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1298,7 +1298,7 @@ virVMXParseConfig(virVMXContext *ctx, } /* Allocate domain def */ - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto cleanup; def->virtType = VIR_DOMAIN_VIRT_VMWARE; diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index 554d28f..3e18a7e 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1093,7 +1093,7 @@ xenParseSxpr(const struct sexpr *root, virDomainDefPtr def; int hvm = 0, vmlocaltime; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto error; tmp = sexpr_node(root, "domain/domid"); diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c index 7913118..95ef5f4 100644 --- a/src/xenconfig/xen_xl.c +++ b/src/xenconfig/xen_xl.c @@ -295,7 +295,7 @@ xenParseXL(virConfPtr conf, virCapsPtr caps, int xendConfigVersion) { virDomainDefPtr def = NULL; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) return NULL; def->virtType = VIR_DOMAIN_VIRT_XEN; diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c index 1e57e24..2f57cd2 100644 --- a/src/xenconfig/xen_xm.c +++ b/src/xenconfig/xen_xm.c @@ -375,7 +375,7 @@ xenParseXM(virConfPtr conf, { virDomainDefPtr def = NULL; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) return NULL; def->virtType = VIR_DOMAIN_VIRT_XEN; diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index 5f87359..f9d1002 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -102,7 +102,7 @@ testReadNetworkConf(const void *data ATTRIBUTE_UNUSED) " </devices>\n" "</domain>\n"; - if (VIR_ALLOC(def) < 0 || + if (!(def = virDomainDefNew()) || VIR_STRDUP(def->os.type, "exe") < 0 || VIR_STRDUP(def->os.init, "/sbin/init") < 0) goto cleanup; diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c index 3b5c3e5..38ab70e 100644 --- a/tests/securityselinuxtest.c +++ b/tests/securityselinuxtest.c @@ -70,7 +70,7 @@ testBuildDomainDef(bool dynamic, virDomainDefPtr def; virSecurityLabelDefPtr secdef; - if (VIR_ALLOC(def) < 0) + if (!(def = virDomainDefNew())) goto error; if (VIR_ALLOC_N(def->seclabels, 1) < 0) -- 2.2.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list