]> granicus.if.org Git - postgresql/commitdiff
Fix minor bugs in commit 30bf4689a96cd283af33edcdd6b7210df3f20cd8 et al.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Nov 2014 17:21:01 +0000 (12:21 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 30 Nov 2014 17:21:01 +0000 (12:21 -0500)
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.

src/interfaces/libpq/fe-connect.c

index f24bb03e84ba550f563c40dfd8aa9ca442fe7a9c..605e35e9fc314387b24a99be58fe49c2ad2c77af 100644 (file)
@@ -592,7 +592,7 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
                        free(conn->sslmode);
                conn->sslmode = strdup("require");
                if (!conn->sslmode)
-                       return false;
+                       goto oom_error;
        }
 #endif
 #if defined(KRB5) || defined(ENABLE_GSS) || defined(ENABLE_SSPI)
@@ -694,7 +694,6 @@ connectOptions2(PGconn *conn)
                        conn->pgpass = strdup(DefaultPassword);
                        if (!conn->pgpass)
                                goto oom_error;
-
                }
                else
                        conn->dot_pgpass_used = true;