struct addrinfo *ai_ptr;
int ai_return;
- socket_entry_t *sockets;
- size_t sockets_num;
+ socket_entry_t *sockets = NULL;
+ size_t sockets_num = 0;
int status;
-
- sockets = *ret_sockets;
- sockets_num = *ret_sockets_num;
+
+ if (*ret_sockets != NULL)
+ return (EINVAL);
memset (&ai_hints, 0, sizeof (ai_hints));
ai_hints.ai_flags = 0;
freeaddrinfo (ai_list);
- if ((*ret_sockets_num) >= sockets_num)
+ if (sockets_num == 0)
+ {
+ sfree (sockets);
return (-1);
+ }
*ret_sockets = sockets;
*ret_sockets_num = sockets_num;