mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Handle PQresultErrorField(PG_DIAG_SQLSTATE) returning NULL in streamutil.c.
Inff27db5dI missed that PQresultErrorField() may return NULL if there's no sqlstate associated with an error. Spotted-By: Coverity Reported-By: Michael Paquier Discussion: CAB7nPqQ3o10SY6NVdU4pjq85GQTN5tbbkq2gnNUh2fBNU3rKyQ@mail.gmail.com Backpatch: 9.5, likeff27db5d
This commit is contained in:
parent
43a8ed26c9
commit
2e6f6f3abe
1 changed files with 3 additions and 1 deletions
|
|
@ -340,7 +340,9 @@ CreateReplicationSlot(PGconn *conn, const char *slot_name, const char *plugin,
|
|||
{
|
||||
const char *sqlstate = PQresultErrorField(res, PG_DIAG_SQLSTATE);
|
||||
|
||||
if (slot_exists_ok && strcmp(sqlstate, ERRCODE_DUPLICATE_OBJECT) == 0)
|
||||
if (slot_exists_ok &&
|
||||
sqlstate &&
|
||||
strcmp(sqlstate, ERRCODE_DUPLICATE_OBJECT) == 0)
|
||||
{
|
||||
destroyPQExpBuffer(query);
|
||||
PQclear(res);
|
||||
|
|
|
|||
Loading…
Reference in a new issue