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:
parent
3b530d90d5
commit
effcafeaa1
@ -8,7 +8,7 @@
|
||||
* Darko Prenosil <Darko.Prenosil@finteh.hr>
|
||||
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.82.2.3 2010/06/03 09:40:17 itagaki Exp $
|
||||
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.82.2.4 2010/06/09 00:56:25 itagaki Exp $
|
||||
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
|
||||
* ALL RIGHTS RESERVED;
|
||||
*
|
||||
@ -2275,9 +2275,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;
|
||||
strlcpy(hentry->name, name, sizeof(hentry->name));
|
||||
|
Loading…
x
Reference in New Issue
Block a user