Commit 1adbb347 authored by Tom Lane's avatar Tom Lane

Fix minor bugs in commit 30bf4689 et al.

Coverity complained that the "else" added to fillPGconn() was unreachable,
which it was.  Remove the dead code.  In passing, rearrange the tests so as
not to bother trying to fetch values for options that can't be assigned.

Pre-9.3 did not have that issue, but it did have a "return" that should be
"goto oom_error" to ensure that a suitable error message gets filled in.
parent 22dfd116
......@@ -684,16 +684,16 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
for (option = PQconninfoOptions; option->keyword; option++)
{
const char *tmp = conninfo_getval(connOptions, option->keyword);
if (tmp && option->connofs >= 0)
if (option->connofs >= 0)
{
char **connmember = (char **) ((char *) conn + option->connofs);
const char *tmp = conninfo_getval(connOptions, option->keyword);
if (*connmember)
free(*connmember);
if (tmp)
{
char **connmember = (char **) ((char *) conn + option->connofs);
if (*connmember)
free(*connmember);
*connmember = strdup(tmp);
if (*connmember == NULL)
{
......@@ -702,8 +702,6 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
return false;
}
}
else
*connmember = NULL;
}
}
......@@ -793,7 +791,6 @@ connectOptions2(PGconn *conn)
conn->pgpass = strdup(DefaultPassword);
if (!conn->pgpass)
goto oom_error;
}
else
conn->dot_pgpass_used = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment