8000 Fix connection leak in dblink when dblink_connect() or dblink_connect… · home201448/postgres@71dca6e · GitHub
[go: up one dir, main page]

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)
0