From: Heikki Linnakangas Date: Wed, 20 Feb 2013 14:22:47 +0000 (+0200) Subject: Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump. X-Git-Tag: REL8_4_17~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f835b71750c58319906aa36c4f00812843f97eb9;p=postgresql Don't pass NULL to fprintf, if a bogus connection string is given to pg_dump. Back-patch to all supported branches. --- diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index b04784e0f9..3bfcaf8db0 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -255,7 +255,8 @@ ConnectDatabase(Archive *AHX, /* check to see that the backend connection was successfully made */ if (PQstatus(AH->connection) == CONNECTION_BAD) die_horribly(AH, modulename, "connection to database \"%s\" failed: %s", - PQdb(AH->connection), PQerrorMessage(AH->connection)); + PQdb(AH->connection) ? PQdb(AH->connection) : "", + PQerrorMessage(AH->connection)); /* check for version mismatch */ _check_database_version(AH);