Don't leak 'str' when we see a malformed IPv6 address.

MFC after:	2 weeks
This commit is contained in:
delphij 2016-11-28 07:33:26 +00:00
parent 7ad79e66ad
commit 2059af8c9f

View File

@ -675,8 +675,10 @@ parse_addr_port(char *arg, const char *def_port, struct addrinfo **ai)
*/
arg++;
addr = strsep(&arg, "]");
if (arg == NULL)
if (arg == NULL) {
free(str);
return (1);
}
if (arg[0] == '\0') {
port = def_port;
} else if (arg[0] == ':') {