Initialize variables in netutl.c

This commit is contained in:
thorkill 2015-06-30 19:23:15 +02:00
parent e2245da720
commit d803ac93dc

View file

@ -33,9 +33,11 @@ bool hostnames = false;
Return NULL on failure.
*/
struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) {
struct addrinfo *ai, hint = {0};
struct addrinfo *ai, hint;
int err;
memset(&hint, 0x0, sizeof(struct addrinfo));
hint.ai_family = addressfamily;
hint.ai_socktype = socktype;
@ -53,10 +55,13 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock
}
sockaddr_t str2sockaddr(const char *address, const char *port) {
struct addrinfo *ai, hint = {0};
sockaddr_t result = {{0}};
struct addrinfo *ai, hint;
sockaddr_t result;
int err;
memset(&hint, 0x0, sizeof(struct addrinfo));
memset(&result, 0x0, sizeof(sockaddr_t));
hint.ai_family = AF_UNSPEC;
hint.ai_flags = AI_NUMERICHOST;
hint.ai_socktype = SOCK_STREAM;