aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2009-11-11 17:13:36 -0800
committerDmitry Shmidt <dimitrysh@google.com>2009-11-11 17:13:36 -0800
commitbe5cce4a3dc21ccdeaaa510cb01fdcff5f6716cc (patch)
tree8ede5411abba2e18a3b5c5253e959bdfae865ad7
parentcf3c05b78e8d0f3816f5b9611af18ec301e338d0 (diff)
downloadwpa_supplicant-be5cce4a3dc21ccdeaaa510cb01fdcff5f6716cc.tar.gz
Check if interface is valid in wpa_ctrl_close()
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--wpa_ctrl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/wpa_ctrl.c b/wpa_ctrl.c
index 32866cf..3c61b27 100644
--- a/wpa_ctrl.c
+++ b/wpa_ctrl.c
@@ -140,8 +140,11 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
void wpa_ctrl_close(struct wpa_ctrl *ctrl)
{
+ if (ctrl == NULL)
+ return;
unlink(ctrl->local.sun_path);
- close(ctrl->s);
+ if (ctrl->s >= 0)
+ close(ctrl->s);
os_free(ctrl);
}