Skip to content

Commit 71dca6e

Browse files
committed
Fix connection leak in dblink when dblink_connect() or dblink_connect_u()
end with "duplicate connection name" errors. Backported to release 7.4.
1 parent 9f3cf8a commit 71dca6e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

contrib/dblink/dblink.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,9 +1980,14 @@ createNewConnection(const char *name, remoteConn * con)
19801980
errmsg("out of memory")));
19811981

19821982
if (found)
1983+
{
1984+
PQfinish(rconn->conn);
1985+
pfree(rconn);
1986+
19831987
ereport(ERROR,
19841988
(errcode(ERRCODE_DUPLICATE_OBJECT),
19851989
errmsg("duplicate connection name")));
1990+
}
19861991

19871992
hentry->rcon = con;
19881993
strncpy(hentry->name, name, NAMEDATALEN - 1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy