Verify that eloop_register_read_sock() succeeds for ctrl_iface setup
This allows faster detection of a case where a memory allocation fails within eloop. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
27d9701dea
commit
86a7fbb2c1
1 changed files with 6 additions and 2 deletions
|
@ -2251,8 +2251,11 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
|
||||||
os_free(fname);
|
os_free(fname);
|
||||||
|
|
||||||
hapd->ctrl_sock = s;
|
hapd->ctrl_sock = s;
|
||||||
eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
|
if (eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
|
||||||
NULL);
|
NULL) < 0) {
|
||||||
|
hostapd_ctrl_iface_deinit(hapd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
hapd->msg_ctx = hapd;
|
hapd->msg_ctx = hapd;
|
||||||
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
|
wpa_msg_register_cb(hostapd_ctrl_iface_msg_cb);
|
||||||
|
|
||||||
|
@ -2299,6 +2302,7 @@ void hostapd_ctrl_iface_deinit(struct hostapd_data *hapd)
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = hapd->ctrl_dst;
|
dst = hapd->ctrl_dst;
|
||||||
|
hapd->ctrl_dst = NULL;
|
||||||
while (dst) {
|
while (dst) {
|
||||||
prev = dst;
|
prev = dst;
|
||||||
dst = dst->next;
|
dst = dst->next;
|
||||||
|
|
Loading…
Reference in a new issue