diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2019-05-14 16:18:51 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2019-05-15 10:10:08 +0200 |
commit | c0c8034bc17519c7960f40f6d796b5485cfc4cdb (patch) | |
tree | ef3079b303164e2c5313a89e97e4d8e4d6aed4b1 /src/dhcpv6-ia.c | |
parent | f98b7ee899d492d32c4d857aa068daf95ae5be7b (diff) |
treewide: init assignment lists head
When allocating an assignment in alloc_assignment; init the circular head
and lease_list circular lists. Avoids checking NULL pointer when freeing
the assignment in free_assignment.
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r-- | src/dhcpv6-ia.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 81c2481..9559b96 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -75,10 +75,10 @@ int dhcpv6_ia_setup_interface(struct interface *iface, bool enable) struct dhcp_assignment *border; if (list_empty(&iface->ia_assignments)) { - border = calloc(1, sizeof(*border)); + border = alloc_assignment(0); if (!border) { - syslog(LOG_ERR, "Calloc failed for border on %s", iface->name); + syslog(LOG_ERR, "Failed to alloc border on %s", iface->name); return -1; } @@ -719,7 +719,7 @@ static void handle_addrlist_change(struct netevent_handler_info *info) while (!list_empty(&reassign)) { c = list_first_entry(&reassign, struct dhcp_assignment, head); - list_del(&c->head); + list_del_init(&c->head); if (!assign_pd(iface, c)) { c->assigned = 0; list_add(&c->head, &iface->ia_assignments); @@ -1237,7 +1237,7 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac if ((!iface->no_dynamic_dhcp || (l && is_na)) && (iface->dhcpv6_pd || iface->dhcpv6_na)) { /* Create new binding */ - a = calloc(1, sizeof(*a) + clid_len); + a = alloc_assignment(clid_len); if (a) { a->clid_len = clid_len; |