Attempt to silence bogus compiler warning: "Potential null pointer dereference"

This commit is contained in:
Yang Tse
2009-09-17 11:45:27 +00:00
parent 250ba99498
commit 31e106ced2
4 changed files with 21 additions and 16 deletions

View File

@@ -3946,9 +3946,11 @@ static CURLcode parse_remote_port(struct SessionHandle *data,
conn->host.name++; /* skip over the starting bracket */
portptr = strchr(conn->host.name, ']');
*portptr++ = 0; /* zero terminate, killing the bracket */
if(':' != *portptr)
portptr = NULL; /* no port number available */
if(portptr) {
*portptr++ = '\0'; /* zero terminate, killing the bracket */
if(':' != *portptr)
portptr = NULL; /* no port number available */
}
}
else
portptr = strrchr(conn->host.name, ':');