minissdpc.c: avoid unix socket leak in getDevicesFromMiniSSDPD()

This commit is contained in:
Thomas Bernard 2015-08-27 10:03:22 +02:00
parent aba8c3f3d7
commit cdccc0290d
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,9 @@
$Id: Changelog.txt,v 1.212 2015/07/23 20:41:50 nanard Exp $
miniUPnP client Changelog.
2015/08/27:
avoid unix socket leak in getDevicesFromMiniSSDPD()
2015/08/16:
Also accept "Up" as ConnectionStatus value

View File

@ -44,7 +44,7 @@ struct sockaddr_un {
struct UPNPDev *
getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath, int * error)
{
struct UPNPDev * devlist;
struct UPNPDev * devlist = NULL;
int s;
int res;
@ -58,9 +58,9 @@ getDevicesFromMiniSSDPD(const char * devtype, const char * socketpath, int * err
if (res < 0) {
if (error)
*error = res;
return NULL;
} else {
devlist = receiveDevicesFromMiniSSDPD(s, error);
}
devlist = receiveDevicesFromMiniSSDPD(s, error);
disconnectFromMiniSSDPD(s);
return devlist;
}
@ -145,6 +145,7 @@ connectToMiniSSDPD(const char * socketpath)
if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0)
{
/*syslog(LOG_WARNING, "connect(\"%s\"): %m", socketpath);*/
close(s);
return MINISSDPC_SOCKET_ERROR;
}
return s;