aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/ctrl_iface.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-01-08 00:29:59 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-08 00:34:08 (GMT)
commit86a7fbb2c18f5200429fea8b69a64c5dcb9673f2 (patch)
tree728050efbcaaaaf809189c2496ef53d9a987307f /hostapd/ctrl_iface.c
parent27d9701dea99cabde6e8afb363b4f107c371da46 (diff)
downloadhostap-86a7fbb2c18f5200429fea8b69a64c5dcb9673f2.zip
hostap-86a7fbb2c18f5200429fea8b69a64c5dcb9673f2.tar.gz
hostap-86a7fbb2c18f5200429fea8b69a64c5dcb9673f2.tar.bz2
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>
Diffstat (limited to 'hostapd/ctrl_iface.c')
-rw-r--r--hostapd/ctrl_iface.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 6c81211..a7235a4 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -2251,8 +2251,11 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
os_free(fname);
hapd->ctrl_sock = s;
- eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
- NULL);
+ if (eloop_register_read_sock(s, hostapd_ctrl_iface_receive, hapd,
+ NULL) < 0) {
+ hostapd_ctrl_iface_deinit(hapd);
+ return -1;
+ }
hapd->msg_ctx = hapd;
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;
+ hapd->ctrl_dst = NULL;
while (dst) {
prev = dst;
dst = dst->next;