valgrind noted that addrs is allocated in netlink_get_interface_linklocal(),
but never freed in one case. While I was looking at that, I found a mysterious
double-realloc in netlink.c.
Signed-off-by: David Härdeman <david@hardeman.nu>
addrs_len = netlink_get_interface_linklocal(iface->ifindex, &addrs);
if (addrs_len > 0) {
for (ssize_t i = 0; i < addrs_len; i++) {
- struct odhcpd_ipaddr *addr = &addrs[i];
-
- if (!addr->tentative) {
+ if (!addrs[i].tentative) {
iface->have_link_local = true;
break;
}
}
+ free(addrs);
}
iface->inuse = true;
return NL_SKIP;
memset(&addrs[ctxt->ret], 0, sizeof(addrs[ctxt->ret]));
-
- addrs = realloc(addrs, sizeof(*addrs)*(ctxt->ret + 1));
- if (!addrs)
- return NL_SKIP;
-
-
memcpy(&addrs[ctxt->ret].addr, &addr, sizeof(addrs[ctxt->ret].addr));
if (ifa->ifa_flags & IFA_F_TENTATIVE)