Parcourir la source

Make wpa_ctrl_close() handle unopened connection

Dmitry Shmidt il y a 14 ans
Parent
commit
36fde1e79c
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      src/common/wpa_ctrl.c

+ 4 - 1
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);
 }