diff options
author | Stephen Frost <sfrost@snowman.net> | 2014-03-03 03:18:51 -0500 |
---|---|---|
committer | Stephen Frost <sfrost@snowman.net> | 2014-03-03 03:18:51 -0500 |
commit | 5592ebac55460866da867df5c783c34e3c9a7cae (patch) | |
tree | a7792bd0189203b5f8acb33d1b312e9baaece5fb /src/backend/libpq/auth.c | |
parent | b1aebbb6a86e96d7b8f3035ac730dfc24652496c (diff) |
Another round of Coverity fixes
Additional non-security issues/improvements spotted by Coverity.
In backend/libpq, no sense trying to protect against port->hba being
NULL after we've already dereferenced it in the switch() statement.
Prevent against possible overflow due to 32bit arithmitic in
basebackup throttling (not yet released, so no security concern).
Remove nonsensical check of array pointer against NULL in procarray.c,
looks to be a holdover from 9.1 and earlier when there were pointers
being used but now it's just an array.
Remove pointer check-against-NULL in tsearch/spell.c as we had already
dereferenced it above (in the strcmp()).
Remove dead code from adt/orderedsetaggs.c, isnull is checked
immediately after each tuplesort_getdatum() call and if true we return,
so no point checking it again down at the bottom.
Remove recently added minor error-condition memory leak in pg_regress.
Diffstat (limited to 'src/backend/libpq/auth.c')
-rw-r--r-- | src/backend/libpq/auth.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index 9d0c3893c8d..f03aa7edc22 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -214,6 +214,7 @@ static void auth_failed(Port *port, int status, char *logdetail) { const char *errstr; + char *cdetail; int errcode_return = ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION; /* @@ -273,17 +274,12 @@ auth_failed(Port *port, int status, char *logdetail) break; } - if (port->hba) - { - char *cdetail; - - cdetail = psprintf(_("Connection matched pg_hba.conf line %d: \"%s\""), - port->hba->linenumber, port->hba->rawline); - if (logdetail) - logdetail = psprintf("%s\n%s", logdetail, cdetail); - else - logdetail = cdetail; - } + cdetail = psprintf(_("Connection matched pg_hba.conf line %d: \"%s\""), + port->hba->linenumber, port->hba->rawline); + if (logdetail) + logdetail = psprintf("%s\n%s", logdetail, cdetail); + else + logdetail = cdetail; ereport(FATAL, (errcode(errcode_return), |