minissdpc.c: fix variable redeclaration of p
-/* $Id: minissdpc.c,v 1.32 2016/10/07 09:04:36 nanard Exp $ */
+/* $Id: minissdpc.c,v 1.39 2019/04/10 12:09:17 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* Project : miniupnp
* Web : http://miniupnp.free.fr/
@@ -492,7 +492,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
struct sockaddr_storage sockudp_w;
#else
int rv;
- struct addrinfo hints, *servinfo, *p;
+ struct addrinfo hints, *servinfo;
#endif
#ifdef _WIN32
unsigned long _ttl = (unsigned long)ttl;
@@ -817,7 +817,8 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
#endif
break;
- }
+ } else {
+ struct addrinfo *p;
for(p = servinfo; p; p = p->ai_next) {
n = sendto(sudp, bufr, n, 0, p->ai_addr, MSC_CAST_INT p->ai_addrlen);
if (n < 0) {
@@ -835,6 +836,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
}
}
freeaddrinfo(servinfo);
+ }
if(!sentok) {
if(error)
*error = MINISSDPC_SOCKET_ERROR;
