Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d6119d8

Browse files
committed
plug dblink resource leak
dblink generates orphaned connections when called with a connection string, fail_on_error = true, and an ERROR occurs. Discovery and patch by Tatsuhito Kasahara. Introduced in 8.4.
1 parent 4ab6ebf commit d6119d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/dblink/dblink.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Darko Prenosil <Darko.Prenosil@finteh.hr>
99
* Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
1010
*
11-
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.83 2009/08/05 16:11:07 joe Exp $
11+
* $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.84 2009/09/12 23:20:52 joe Exp $
1212
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
1313
* ALL RIGHTS RESERVED;
1414
*
@@ -855,9 +855,9 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async)
855855
(PQresultStatus(res) != PGRES_COMMAND_OK &&
856856
PQresultStatus(res) != PGRES_TUPLES_OK))
857857
{
858-
dblink_res_error(conname, res, "could not execute query", fail);
859858
if (freeconn)
860859
PQfinish(conn);
860+
dblink_res_error(conname, res, "could not execute query", fail);
861861
MemoryContextSwitchTo(oldcontext);
862862
SRF_RETURN_DONE(funcctx);
863863
}

0 commit comments

Comments
 (0)