if (vlan_id > BRIDGE_VLAN_ID_MAX)
ret_errno(EINVAL);
- list = malloc(sizeof(*list));
+ list = lxc_list_new();
if (!list)
return ret_errno(ENOMEM);
- lxc_list_init(list);
list->elem = UINT_TO_PTR(vlan_id);
lxc_list_add_tail(&netdev->priv.veth_attr.vlan_tagged_ids, move_ptr(list));
if (!netdev)
return ret_errno(EINVAL);
- inetdev = malloc(sizeof(*inetdev));
+ inetdev = zalloc(sizeof(*inetdev));
if (!inetdev)
return ret_errno(ENOMEM);
- memset(inetdev, 0, sizeof(*inetdev));
- list = malloc(sizeof(*list));
+ list = lxc_list_new();
if (!list)
return ret_errno(ENOMEM);
- lxc_list_init(list);
-
addr = strdup(value);
if (!addr)
return ret_errno(ENOMEM);
__do_free struct in_addr *gw = NULL;
int ret;
- gw = malloc(sizeof(*gw));
+ gw = zalloc(sizeof(*gw));
if (!gw)
return ret_errno(ENOMEM);
EINVAL, "Invalid ipv4 route \"%s\", can only be used with veth network",
value);
- inetdev = malloc(sizeof(*inetdev));
+ inetdev = zalloc(sizeof(*inetdev));
if (!inetdev)
return ret_errno(ENOMEM);
- memset(inetdev, 0, sizeof(*inetdev));
- list = malloc(sizeof(*list));
+ list = lxc_list_new();
if (!list)
return ret_errno(ENOMEM);
- lxc_list_init(list);
list->elem = inetdev;
valdup = strdup(value);
if (!netdev)
return ret_errno(EINVAL);
- inet6dev = malloc(sizeof(*inet6dev));
+ inet6dev = zalloc(sizeof(*inet6dev));
if (!inet6dev)
return ret_errno(ENOMEM);
- memset(inet6dev, 0, sizeof(*inet6dev));
- list = malloc(sizeof(*list));
+ list = lxc_list_new();
if (!list)
return ret_errno(ENOMEM);
- lxc_list_init(list);
-
valdup = strdup(value);
if (!valdup)
return ret_errno(ENOMEM);
int ret;
__do_free struct in6_addr *gw = NULL;
- gw = malloc(sizeof(*gw));
+ gw = zalloc(sizeof(*gw));
if (!gw)
return ret_errno(ENOMEM);
EINVAL, "Invalid ipv6 route \"%s\", can only be used with veth network",
value);
- inet6dev = malloc(sizeof(*inet6dev));
+ inet6dev = zalloc(sizeof(*inet6dev));
if (!inet6dev)
return ret_errno(ENOMEM);
- memset(inet6dev, 0, sizeof(*inet6dev));
- list = malloc(sizeof(*list));
+ list = lxc_list_new();
if (!list)
return ret_errno(ENOMEM);
- lxc_list_init(list);
-
valdup = strdup(value);
if (!valdup)
return -1;
__do_free char *val = hook;
struct lxc_list *hooklist;
- hooklist = malloc(sizeof(*hooklist));
+ hooklist = lxc_list_new();
if (!hooklist)
return ret_errno(ENOMEM);
lxc_iterate_parts(token, groups, " \t") {
__do_free struct lxc_list *grouplist = NULL;
- grouplist = malloc(sizeof(*grouplist));
+ grouplist = lxc_list_new();
if (!grouplist)
return ret_errno(ENOMEM);
if (lxc_config_value_empty(value))
return lxc_clear_environment(lxc_conf);
- list_item = malloc(sizeof(*list_item));
+ list_item = lxc_list_new();
if (!list_item)
return ret_errno(ENOMEM);
if (lxc_config_value_empty(value))
return lxc_clear_apparmor_raw(lxc_conf);
- list = malloc(sizeof(*list));
+ list = lxc_list_new();
if (!list)
return ret_errno(ENOMEM);
if (*subkey == '\0')
return ret_errno(EINVAL);
- cglist = malloc(sizeof(*cglist));
+ cglist = lxc_list_new();
if (!cglist)
return ret_errno(ENOMEM);
- cgelem = malloc(sizeof(*cgelem));
+ cgelem = zalloc(sizeof(*cgelem));
if (!cgelem)
return ret_errno(ENOMEM);
- memset(cgelem, 0, sizeof(*cgelem));
cgelem->subsystem = strdup(subkey);
if (!cgelem->subsystem)
}
/* allocate list element */
- limlist = malloc(sizeof(*limlist));
+ limlist = lxc_list_new();
if (!limlist)
return ret_errno(ENOMEM);
- limelem = malloc(sizeof(*limelem));
+ limelem = zalloc(sizeof(*limelem));
if (!limelem)
return ret_errno(ENOMEM);
- memset(limelem, 0, sizeof(*limelem));
limelem->resource = strdup(key);
if (!limelem->resource)
}
/* allocate list element */
- sysctl_list = zalloc(sizeof(*sysctl_list));
+ sysctl_list = lxc_list_new();
if (!sysctl_list)
return ret_errno(ENOMEM);
- lxc_list_init(sysctl_list);
sysctl_elem = zalloc(sizeof(*sysctl_elem));
if (!sysctl_elem)
if (*subkey == '\0')
return ret_errno(EINVAL);
- proclist = malloc(sizeof(*proclist));
+ proclist = lxc_list_new();
if (!proclist)
return ret_errno(ENOMEM);
- procelem = malloc(sizeof(*procelem));
+ procelem = zalloc(sizeof(*procelem));
if (!procelem)
return ret_errno(ENOMEM);
- memset(procelem, 0, sizeof(*procelem));
procelem->filename = strdup(subkey);
if (!procelem->filename)
if (lxc_config_value_empty(value))
return lxc_clear_idmaps(lxc_conf);
- idmaplist = malloc(sizeof(*idmaplist));
+ idmaplist = lxc_list_new();
if (!idmaplist)
return ret_errno(ENOMEM);
- idmap = malloc(sizeof(*idmap));
+ idmap = zalloc(sizeof(*idmap));
if (!idmap)
return ret_errno(ENOMEM);
- memset(idmap, 0, sizeof(*idmap));
ret = parse_idmaps(value, &type, &nsid, &hostid, &range);
if (ret < 0)
if (lxc_config_value_empty(value))
return lxc_clear_mount_entries(lxc_conf);
- mntlist = malloc(sizeof(*mntlist));
+ mntlist = lxc_list_new();
if (!mntlist)
return ret_errno(ENOMEM);
if (strequal(token, "none"))
lxc_clear_config_keepcaps(lxc_conf);
- keeplist = malloc(sizeof(*keeplist));
+ keeplist = lxc_list_new();
if (!keeplist)
return ret_errno(ENOMEM);
* split these caps in a single element for the list.
*/
lxc_iterate_parts(token, dropcaps, " \t") {
- droplist = malloc(sizeof(*droplist));
+ droplist = lxc_list_new();
if (!droplist)
return ret_errno(ENOMEM);
return 0;
}
- utsname = malloc(sizeof(*utsname));
+ utsname = zalloc(sizeof(*utsname));
if (!utsname)
return ret_errno(ENOMEM);
}
}
- new = malloc(sizeof(struct new_config_item));
+ new = zalloc(sizeof(struct new_config_item));
if (!new)
return NULL;
{
__do_free struct lxc_list *dent = NULL;
- dent = malloc(sizeof(struct lxc_list));
+ dent = lxc_list_new();
if (!dent)
return ret_errno(ENOMEM);