Check if interface is valid in wpa_ctrl_close()

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
diff --git a/wpa_ctrl.c b/wpa_ctrl.c
index 32866cf..3c61b27 100644
--- a/wpa_ctrl.c
+++ b/wpa_ctrl.c
@@ -140,8 +140,11 @@
 
 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);
 }