Chris Browne cbbrowne at lists.slony.info
Fri Jun 20 15:19:13 PDT 2008
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv32628

Modified Files:
      Tag: REL_1_2_STABLE
	remote_worker.c 
Log Message:
There are a few memory leaks in the slon process because some results of
PQexec() calls are not always cleared, in remoteListenThread_main()
(remote_listen.c) and in copy_set() (remote_worker.c) functions.

- patch per Damian Quiroga
http://bugs.slony.info/bugzilla/show_bug.cgi?id=52

Note that these queries are already restructured in CVS HEAD, so this
only affects the 1.2 branch.



Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.124.2.33
retrieving revision 1.124.2.34
diff -C2 -d -r1.124.2.33 -r1.124.2.34
*** remote_worker.c	17 Mar 2008 15:12:56 -0000	1.124.2.33
--- remote_worker.c	20 Jun 2008 22:19:10 -0000	1.124.2.34
***************
*** 3052,3055 ****
--- 3052,3056 ----
  		/* Are we running on < PG 7.4???  result =	*/
  		nodeon73 = atoi(PQgetvalue(res4, 0, 0));
+ 		PQclear(res4);
  
  		slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: "
***************
*** 3090,3093 ****
--- 3091,3095 ----
  			if (rc < 0)
  			{
+ 				PQclear(res2);
  				slon_disconnectdb(pro_conn);
  				dstring_free(&query1);
***************
*** 3132,3135 ****
--- 3134,3138 ----
  			return -1;
  		}
+ 		PQclear(res3);
  
  		/*
***************
*** 3152,3156 ****
  				PQfreemem(copydata);
  				PQputCopyEnd(loc_dbconn, "Slony-I: copy set operation failed");
- 				PQclear(res3);
  				PQclear(res2);
  				PQclear(res1);
--- 3155,3158 ----
***************
*** 3174,3178 ****
  					PQfreemem(copydata);
  					PQputCopyEnd(loc_dbconn, "Slony-I: copy set operation");
- 					PQclear(res3);
  					PQclear(res2);
  					PQclear(res1);
--- 3176,3179 ----
***************
*** 3199,3203 ****
  					 node->no_id, PQerrorMessage(pro_dbconn));
  			PQputCopyEnd(loc_dbconn, "Slony-I: copy set operation failed");
- 			PQclear(res3);
  			PQclear(res2);
  			PQclear(res1);
--- 3200,3203 ----
***************
*** 3257,3260 ****
--- 3257,3261 ----
  			return -1;
  		}
+ 		PQclear(res2);
  		res2 = PQgetResult(loc_dbconn);
  		if (PQresultStatus(res2) != PGRES_COMMAND_OK)



More information about the Slony1-commit mailing list