Minor PQclean additions in psql

Поиск
Список
Период
Сортировка
Искать

Minor PQclean additions in psql

От:
"Greg Sabino Mullane" <greg@turnstep.com>
Дата:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message


Missing calls to PQclear in large_obj.c and describe.c


Index: large_obj.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/large_obj.c,v
retrieving revision 1.25
diff -c -r1.25 large_obj.c
*** large_obj.c	18 Apr 2003 23:38:47 -0000	1.25
--- large_obj.c	27 Jun 2003 15:48:12 -0000
***************
*** 78,83 ****
--- 78,84 ----
  	}
  
  	PQsetNoticeProcessor(pset.db, old_notice_hook, NULL);
+ 	PQclear(res);
  	return true;
  }
  
***************
*** 324,329 ****
--- 325,331 ----
  			}
  			return false;
  		}
+ 		PQclear(res);
  	}
  
  	if (own_transaction)
Index: describe.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/describe.c,v
retrieving revision 1.77
diff -c -r1.77 describe.c
*** describe.c	28 May 2003 16:03:59 -0000	1.77
--- describe.c	27 Jun 2003 15:48:13 -0000
***************
*** 963,969 ****
--- 963,972 ----
  							  oid);
  			result2 = PSQLexec(buf.data, false);
  			if (!result2)
+ 			{
+ 				PQclear(result1);
  				goto error_return;
+ 			}
  			else
  				check_count = PQntuples(result2);
  		}
***************
*** 978,984 ****
--- 981,991 ----
  							  oid);
  			result3 = PSQLexec(buf.data, false);
  			if (!result3)
+ 			{
+ 				PQclear(result1);
+ 				PQclear(result2);
  				goto error_return;
+ 			}
  			else
  				rule_count = PQntuples(result3);
  		}
***************
*** 998,1004 ****
--- 1005,1016 ----
  							  oid);
  			result4 = PSQLexec(buf.data, false);
  			if (!result4)
+ 			{
+ 				PQclear(result1);
+ 				PQclear(result2);
+ 				PQclear(result3);
  				goto error_return;
+ 			}
  			else
  				trigger_count = PQntuples(result4);
  		}
***************
*** 1014,1020 ****
--- 1026,1038 ----
  							  oid);
  			result5 = PSQLexec(buf.data, false);
  			if (!result5)
+ 			{
+ 				PQclear(result1);
+ 				PQclear(result2);
+ 				PQclear(result3);
+ 				PQclear(result4);
  				goto error_return;
+ 			}
  			else
  				foreignkey_count = PQntuples(result5);
  		}






--
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200306271147


-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html

iD8DBQE+/GeYvJuQZxSWSsgRAtcIAJ92mG2uOQQG22kqn0CFuwb66ecn0wCfUvxF
imu/R8ic9OWQggcG4CW9zFc=
=oe9G
-----END PGP SIGNATURE-----


Re: Minor PQclean additions in psql

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Greg Sabino Mullane"  writes:
> Missing calls to PQclear in large_obj.c and describe.c

Good catch -- applied.  (I wonder though if it wouldn't be cleaner to
change describeOneTableDetails() so that all the PGresults are freed at
the bottom, rather than only "res".)

			regards, tom lane
FAQ