nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, cb_addr_finish, &ctxt);
nl_cb_err(cb, NL_CB_CUSTOM, cb_addr_error, &ctxt);
- nl_send_auto_complete(rtnl_socket, msg);
+ ctxt.ret = nl_send_auto_complete(rtnl_socket, msg);
+ if (ctxt.ret < 0)
+ goto free;
+
+ ctxt.ret = 0;
while (ctxt.pending > 0)
nl_recvmsgs(rtnl_socket, cb);
- nlmsg_free(msg);
-
if (ctxt.ret <= 0)
- goto out;
+ goto free;
time_t now = odhcpd_time();
struct odhcpd_ipaddr *addr = *addrs;
addr[i].valid += now;
}
+free:
+ nlmsg_free(msg);
out:
nl_cb_put(cb);
nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, cb_proxy_neigh_finish, &ctxt);
nl_cb_err(cb, NL_CB_CUSTOM, cb_proxy_neigh_error, &ctxt);
- nl_send_auto_complete(rtnl_socket, msg);
+ ctxt.ret = nl_send_auto_complete(rtnl_socket, msg);
+ if (ctxt.ret < 0)
+ goto free;
+
while (ctxt.pending > 0)
nl_recvmsgs(rtnl_socket, cb);
+free:
nlmsg_free(msg);
-
out:
nl_cb_put(cb);