summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-02-08 18:50:30 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2014-02-08 18:50:30 +0100
commit4d8089697f1bcc494e80f7f5e12ffaa8ecf1282a (patch)
treebe830ba53504a93689789d3a3618ecfb1b534a4c
parent115747f840dbcaaadd2ab604144d3850fff6723f (diff)
wpa: make sure wpa-ctrl stays around during dispatch
If we call into user-callbacks, we need to make sure that they do not free the wpa-object. We want to explicitly allow that so take a ref before calling any callback and drop it afterwards. We already check for !open so we bail out early if sth fails. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/wpa_ctrl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wpa_ctrl.c b/src/wpa_ctrl.c
index fa3a643..34b626a 100644
--- a/src/wpa_ctrl.c
+++ b/src/wpa_ctrl.c
@@ -561,6 +561,8 @@ int wfd_wpa_ctrl_dispatch(struct wfd_wpa_ctrl *wpa, int timeout)
n = max;
}
+ wfd_wpa_ctrl_ref(wpa);
+
r = 0;
for (i = 0; i < n; ++i) {
e = &ev[i];
@@ -575,6 +577,8 @@ int wfd_wpa_ctrl_dispatch(struct wfd_wpa_ctrl *wpa, int timeout)
break;
}
+ wfd_wpa_ctrl_unref(wpa);
+
return r;
}