mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
openvz: use g_new0 instead of VIR_ALLOC*
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
1725d0bfbc
commit
8e6340631a
@ -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,
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user