Fix a couple file descriptor leaks.
This commit is contained in:
parent
2aedabb52c
commit
a21bbe557d
@ -202,11 +202,10 @@ getsyshwaddr(char *buf, int len)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
continue;
|
continue;
|
||||||
strncpy(ifr.ifr_name, p->ifa_name, IFNAMSIZ);
|
strncpy(ifr.ifr_name, p->ifa_name, IFNAMSIZ);
|
||||||
if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0)
|
ret = ioctl(fd, SIOCGIFHWADDR, &ifr);
|
||||||
{
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
if (ret < 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
memcpy(mac, ifr.ifr_hwaddr.sa_data, 6);
|
memcpy(mac, ifr.ifr_hwaddr.sa_data, 6);
|
||||||
#else
|
#else
|
||||||
struct sockaddr_dl *sdl;
|
struct sockaddr_dl *sdl;
|
||||||
|
@ -771,6 +771,7 @@ SubmitServicesToMiniSSDPD(const char *host, unsigned short port)
|
|||||||
{
|
{
|
||||||
DPRINTF(E_ERROR, L_SSDP, "connect(\"%s\"): %s",
|
DPRINTF(E_ERROR, L_SSDP, "connect(\"%s\"): %s",
|
||||||
minissdpdsocketpath, strerror(errno));
|
minissdpdsocketpath, strerror(errno));
|
||||||
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (i = 0; known_service_types[i]; i++)
|
for (i = 0; known_service_types[i]; i++)
|
||||||
@ -802,6 +803,7 @@ SubmitServicesToMiniSSDPD(const char *host, unsigned short port)
|
|||||||
if(write(s, buffer, p - buffer) < 0)
|
if(write(s, buffer, p - buffer) < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_ERROR, L_SSDP, "write(): %s", strerror(errno));
|
DPRINTF(E_ERROR, L_SSDP, "write(): %s", strerror(errno));
|
||||||
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user