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)
|
||||
continue;
|
||||
strncpy(ifr.ifr_name, p->ifa_name, IFNAMSIZ);
|
||||
if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0)
|
||||
{
|
||||
ret = ioctl(fd, SIOCGIFHWADDR, &ifr);
|
||||
close(fd);
|
||||
if (ret < 0)
|
||||
continue;
|
||||
}
|
||||
memcpy(mac, ifr.ifr_hwaddr.sa_data, 6);
|
||||
#else
|
||||
struct sockaddr_dl *sdl;
|
||||
|
@ -771,6 +771,7 @@ SubmitServicesToMiniSSDPD(const char *host, unsigned short port)
|
||||
{
|
||||
DPRINTF(E_ERROR, L_SSDP, "connect(\"%s\"): %s",
|
||||
minissdpdsocketpath, strerror(errno));
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
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)
|
||||
{
|
||||
DPRINTF(E_ERROR, L_SSDP, "write(): %s", strerror(errno));
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user