/**
* virSocketParseAddr:
* @val: a numeric network address IPv4 or IPv6
- * @addr: where to store the return value.
+ * @addr: where to store the return value, optional.
* @hint: optional hint to pass down to getaddrinfo
*
* Mostly a wrapper for getaddrinfo() extracting the address storage
struct addrinfo hints;
struct addrinfo *res = NULL;
- if ((val == NULL) || (addr == NULL))
+ if (val == NULL)
return(-1);
memset(&hints, 0, sizeof(hints));
}
len = res->ai_addrlen;
- memcpy(&addr->stor, res->ai_addr, len);
+ if (addr != NULL)
+ memcpy(&addr->stor, res->ai_addr, len);
freeaddrinfo(res);
return(len);