diff --git a/upnp/src/genlib/net/uri/uri.c b/upnp/src/genlib/net/uri/uri.c index dff0c96..96b2a32 100644 --- a/upnp/src/genlib/net/uri/uri.c +++ b/upnp/src/genlib/net/uri/uri.c @@ -387,7 +387,7 @@ static int parse_hostport( ret = getaddrinfo(srvname, NULL, &hints, &res0); if (ret == 0) { - for (res = res0; res && !ret; res = res->ai_next) { + for (res = res0; res; res = res->ai_next) { switch (res->ai_family) { case AF_INET: case AF_INET6: @@ -395,12 +395,10 @@ static int parse_hostport( memcpy(&out->IPaddress, res->ai_addr, res->ai_addrlen); - ret=1; - break; - default: - break; + goto found; } } +found: freeaddrinfo(res0); if (res == NULL) /* Didn't find an AF_INET or AF_INET6 address. */