This patch fixes a small memory leak in libpq: the 'pstatus' field of
PGconn is a linked list of malloc'ed nodes, so it should be freed on
PQfinish().

-Neil

Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.262
diff -c -r1.262 fe-connect.c
*** src/interfaces/libpq/fe-connect.c	2 Oct 2003 19:52:44 -0000	1.262
--- src/interfaces/libpq/fe-connect.c	18 Oct 2003 03:31:38 -0000
***************
*** 2003,2010 ****
--- 2003,2022 ----
  static void
  freePGconn(PGconn *conn)
  {
+ 	pgParameterStatus *pstatus;
+ 	pgParameterStatus *prev;
+ 
  	if (!conn)
  		return;
+ 
+ 	pstatus = conn->pstatus;
+ 	while (pstatus != NULL)
+ 	{
+ 		prev = pstatus;
+ 		pstatus = prev->next;
+ 		free(prev);
+ 	}
+ 
  	pqClearAsyncResult(conn);	/* deallocate result and curTuple */
  	if (conn->sock >= 0)
  	{
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to