anetTcpGenericConnect(), jump to error not end on error

Two code paths jumped to the "ok, return the socket to the user" code
path to handle error conditions.

Related to issues #2609 and #2612.
This commit is contained in:
antirez 2015-06-11 12:46:55 +02:00
parent a401a84eb2
commit 8fa8b251a9

View File

@ -295,7 +295,7 @@ static int anetTcpGenericConnect(char *err, char *addr, int port,
if ((rv = getaddrinfo(source_addr, NULL, &hints, &bservinfo)) != 0)
{
anetSetError(err, "%s", gai_strerror(rv));
goto end;
goto error;
}
for (b = bservinfo; b != NULL; b = b->ai_next) {
if (bind(s,b->ai_addr,b->ai_addrlen) != -1) {
@ -306,7 +306,7 @@ static int anetTcpGenericConnect(char *err, char *addr, int port,
freeaddrinfo(bservinfo);
if (!bound) {
anetSetError(err, "bind: %s", strerror(errno));
goto end;
goto error;
}
}
if (connect(s,p->ai_addr,p->ai_addrlen) == -1) {