]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Make wpa_ctrl_close() handle unopened connection
authorDmitry Shmidt <dimitrysh@google.com>
Sun, 27 Feb 2011 15:07:07 +0000 (17:07 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 27 Feb 2011 15:07:07 +0000 (17:07 +0200)
src/common/wpa_ctrl.c

index 81fe6ba09db00ff38b6c707ca0646e8a09178d63..c151934184a905143582d345008f760def1025ec 100644 (file)
@@ -127,8 +127,11 @@ try_again:
 
 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);
 }