Xinqi Bao's Git

Fix a bug in wifi_essid().
[slstatus.git] / components / wifi.c
index 9ecb8e1..3767b21 100644 (file)
@@ -77,6 +77,7 @@ wifi_essid(const char *iface)
        wreq.u.essid.pointer = id;
        if (ioctl(sockfd,SIOCGIWESSID, &wreq) == -1) {
                warn("Failed to get ESSID for interface %s", iface);
        wreq.u.essid.pointer = id;
        if (ioctl(sockfd,SIOCGIWESSID, &wreq) == -1) {
                warn("Failed to get ESSID for interface %s", iface);
+               close(sockfd);
                return NULL;
        }
 
                return NULL;
        }