mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix connection leak in dblink when dblink_connect() or dblink_connect_u()
end with "duplicate connection name" errors. Backported to release 7.4.
This commit is contained in:
@ -2151,9 +2151,14 @@ createNewConnection(const char *name, remoteConn * rconn)
|
||||
HASH_ENTER, &found);
|
||||
|
||||
if (found)
|
||||
{
|
||||
PQfinish(rconn->conn);
|
||||
pfree(rconn);
|
||||
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||
errmsg("duplicate connection name")));
|
||||
}
|
||||
|
||||
hentry->rconn = rconn;
|
||||
strncpy(hentry->name, name, NAMEDATALEN - 1);
|
||||
|
Reference in New Issue
Block a user