Author: turnstep
Date: Sat Mar 1 18:21:33 2008
New Revision: 10862
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/dbdimp.c
Log:
Memory leak patch from Alexey Tourbin, per bug #33743.
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Sat Mar 1 18:21:33 2008
@@ -2,6 +2,8 @@
2.2.1
+ - Fixed memory leaks in dbdimp.c (CPAN bug #33743)
+ [Alexey Tourbin]
- Fixed strlen problems in dbdimp.c (CPAN bug #33737)
[Alexey Tourbin]
- Fixed char count in Renew() (CPAN bug #33738)
Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c (original)
+++ DBD-Pg/trunk/dbdimp.c Sat Mar 1 18:21:33 2008
@@ -3824,13 +3824,9 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_savepoint (name: %s)\n",
THEADER, savepoint);
- New(0, action, strlen(savepoint) + 11, char); /* freed below */
-
if (imp_dbh->pg_server_version < 80000)
croak("Savepoints are only supported on server version 8.0 or
higher");
- sprintf(action, "savepoint %s", savepoint);
-
/* no action if AutoCommit = on or the connection is invalid */
if ((NULL == imp_dbh->conn) || (DBIc_has(imp_dbh, DBIcf_AutoCommit))) {
if (TEND) TRC(DBILOGFP, "%sEnd pg_db_savepoint (0)\n", THEADER);
@@ -3849,6 +3845,8 @@
imp_dbh->done_begin = DBDPG_TRUE;
}
+ New(0, action, strlen(savepoint) + 11, char); /* freed below */
+ sprintf(action, "savepoint %s", savepoint);
status = _result(aTHX_ imp_dbh, action);
Safefree(action);
@@ -3875,19 +3873,17 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_rollback_to (name: %s)\n",
THEADER, savepoint);
- New(0, action, strlen(savepoint) + 13, char);
-
if (imp_dbh->pg_server_version < 80000)
croak("Savepoints are only supported on server version 8.0 or
higher");
- sprintf(action, "rollback to %s", savepoint);
-
/* no action if AutoCommit = on or the connection is invalid */
if ((NULL == imp_dbh->conn) || (DBIc_has(imp_dbh, DBIcf_AutoCommit))) {
if (TEND) TRC(DBILOGFP, "%sEnd pg_db_rollback_to (0)\n",
THEADER);
return 0;
}
+ New(0, action, strlen(savepoint) + 13, char);
+ sprintf(action, "rollback to %s", savepoint);
status = _result(aTHX_ imp_dbh, action);
Safefree(action);
@@ -3914,19 +3910,17 @@
if (TSTART) TRC(DBILOGFP, "%sBegin pg_db_release (name: %s)\n",
THEADER, savepoint);
- New(0, action, strlen(savepoint) + 9, char);
-
if (imp_dbh->pg_server_version < 80000)
croak("Savepoints are only supported on server version 8.0 or
higher");
- sprintf(action, "release %s", savepoint);
-
/* no action if AutoCommit = on or the connection is invalid */
if ((NULL == imp_dbh->conn) || (DBIc_has(imp_dbh, DBIcf_AutoCommit))) {
if (TEND) TRC(DBILOGFP, "%sEnd pg_db_release (0)\n", THEADER);
return 0;
}
+ New(0, action, strlen(savepoint) + 9, char);
+ sprintf(action, "release %s", savepoint);
status = _result(aTHX_ imp_dbh, action);
Safefree(action);