Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/openvz/openvz_conf.c | 12 ++++--------
src/openvz/openvz_driver.c | 3 +--
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 6d54123a35..8f1740863c 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -205,8 +205,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
} else if (ret > 0) {
token = strtok_r(temp, " ", &saveptr);
while (token != NULL) {
- if (VIR_ALLOC(net) < 0)
- goto error;
+ net = g_new0(virDomainNetDef, 1);
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
if (virDomainNetAppendIPAddress(net, token, AF_UNSPEC, 0) < 0)
@@ -238,8 +237,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
int len;
/* add new device to list */
- if (VIR_ALLOC(net) < 0)
- goto error;
+ net = g_new0(virDomainNetDef, 1);
net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;
@@ -259,8 +257,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
goto error;
}
- if (VIR_ALLOC_N(net->ifname, len+1) < 0)
- goto error;
+ net->ifname = g_new0(char, len+1);
if (virStrncpy(net->ifname, p, len, len+1) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -276,8 +273,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
goto error;
}
- if (VIR_ALLOC_N(net->data.bridge.brname, len+1) < 0)
- goto error;
+ net->data.bridge.brname = g_new0(char, len+1);
if (virStrncpy(net->data.bridge.brname, p, len, len+1) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 71e270ea09..f90ae4fe69 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1287,8 +1287,7 @@ static virDrvOpenStatus openvzConnectOpen(virConnectPtr conn,
/* We now know the URI is definitely for this driver, so beyond
* here, don't return DECLINED, always use ERROR */
- if (VIR_ALLOC(driver) < 0)
- return VIR_DRV_OPEN_ERROR;
+ driver = g_new0(struct openvz_driver, 1);
if (!(driver->domains = virDomainObjListNew()))
goto cleanup;
--
2.26.2