mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Fix minor bugs in commit 30bf4689a9
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.
This commit is contained in:
parent
22dfd116a1
commit
1adbb347ec
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user