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

Commitd21d61b

Browse files
committed
Put back initialization of 'sslmode', to silence Coverity
Coverity pointed out that the function checks for conn->sslmode !=NULL, which implies that it might be NULL, but later we access itwithout a NULL-check anyway. It doesn't know that it is in fact alwaysinitialized earlier, in conninfo_add_defaults(), and hence theNULL-check is not necessary. However, there is a lot of distancebetween conninfo_add_defaults() and pqConnectOptions2(), so it's notsurprising that it doesn't see that. Put back the initialization code,as it existed before commit05fd30c, to silence the warning.In the long run, I'd like to refactor the libpq options handling andinitalization code. It seems silly to strdup() and copy strings, forthings like sslmode that have a limited set of possible values; itshould be an enum. But that's for another day.
1 parentcd4b6af commitd21d61b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,12 @@ pqConnectOptions2(PGconn *conn)
15761576
}
15771577
#endif
15781578
}
1579+
else
1580+
{
1581+
conn->sslmode=strdup(DefaultSSLMode);
1582+
if (!conn->sslmode)
1583+
gotooom_error;
1584+
}
15791585

15801586
/*
15811587
* validate sslnegotiation option, default is "postgres" for the postgres

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp