From: Dmitry Shmidt Date: Sun, 27 Feb 2011 15:07:07 +0000 (+0200) Subject: Make wpa_ctrl_close() handle unopened connection X-Git-Tag: hostap-1-bp~541 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36fde1e79cd226a91ce2ae56ff065c409790d5d7;p=thirdparty%2Fhostap.git Make wpa_ctrl_close() handle unopened connection --- diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c index 81fe6ba09..c15193418 100644 --- a/src/common/wpa_ctrl.c +++ b/src/common/wpa_ctrl.c @@ -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); }