mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +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);
|
HASH_ENTER, &found);
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
|
{
|
||||||
|
PQfinish(rconn->conn);
|
||||||
|
pfree(rconn);
|
||||||
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
(errcode(ERRCODE_DUPLICATE_OBJECT),
|
||||||
errmsg("duplicate connection name")));
|
errmsg("duplicate connection name")));
|
||||||
|
}
|
||||||
|
|
||||||
hentry->rconn = rconn;
|
hentry->rconn = rconn;
|
||||||
strncpy(hentry->name, name, NAMEDATALEN - 1);
|
strncpy(hentry->name, name, NAMEDATALEN - 1);
|
||||||
|
Reference in New Issue
Block a user