Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1adbb34

Browse files
committed
Fix minor bugs in commit30bf468 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 asnot 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.
1 parent22dfd11 commit1adbb34

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

‎src/interfaces/libpq/fe-connect.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -684,16 +684,16 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
684684

685685
for (option=PQconninfoOptions;option->keyword;option++)
686686
{
687-
constchar*tmp=conninfo_getval(connOptions,option->keyword);
688-
689-
if (tmp&&option->connofs >=0)
687+
if (option->connofs >=0)
690688
{
691-
char**connmember=(char**) ((char*)conn+option->connofs);
689+
constchar*tmp=conninfo_getval(connOptions,option->keyword);
692690

693-
if (*connmember)
694-
free(*connmember);
695691
if (tmp)
696692
{
693+
char**connmember= (char**) ((char*)conn+option->connofs);
694+
695+
if (*connmember)
696+
free(*connmember);
697697
*connmember=strdup(tmp);
698698
if (*connmember==NULL)
699699
{
@@ -702,8 +702,6 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
702702
return false;
703703
}
704704
}
705-
else
706-
*connmember=NULL;
707705
}
708706
}
709707

@@ -793,7 +791,6 @@ connectOptions2(PGconn *conn)
793791
conn->pgpass=strdup(DefaultPassword);
794792
if (!conn->pgpass)
795793
gotooom_error;
796-
797794
}
798795
else
799796
conn->dot_pgpass_used= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp