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,7 +127,10 @@ 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);
if (ctrl->s >= 0)
close(ctrl->s); close(ctrl->s);
os_free(ctrl); os_free(ctrl);
} }