Make wpa_ctrl_close() handle unopened connection

This commit is contained in:
Dmitry Shmidt 2011-02-27 17:07:07 +02:00 committed by Jouni Malinen
parent 28878f8b0e
commit 36fde1e79c

View file

@ -127,8 +127,11 @@ try_again:
void wpa_ctrl_close(struct wpa_ctrl *ctrl) void wpa_ctrl_close(struct wpa_ctrl *ctrl)
{ {
if (ctrl == NULL)
return;
unlink(ctrl->local.sun_path); unlink(ctrl->local.sun_path);
close(ctrl->s); if (ctrl->s >= 0)
close(ctrl->s);
os_free(ctrl); os_free(ctrl);
} }