Skip Menu |
 

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 33743
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: ATOURBIN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.0.0
Fixed in: 2.2.1

Attachments


Subject: dbdimp.c: fixed some memory leaks
Here is the patch that fixes 3 similar memory leaks. -- Alexey Tourbin ALT Linux Team
Subject: DBD-Pg-2.2.0-action-leaks.patch
diff --git a/dbdimp.c b/dbdimp.c index 228c8ec..f9ee3f4 100644 --- a/dbdimp.c +++ b/dbdimp.c @@ -3825,13 +3825,9 @@ int pg_db_savepoint (SV * dbh, imp_dbh_t * imp_dbh, char * savepoint) 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); @@ -3850,6 +3846,8 @@ int pg_db_savepoint (SV * dbh, imp_dbh_t * imp_dbh, char * savepoint) 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); @@ -3876,19 +3874,17 @@ int pg_db_rollback_to (SV * dbh, imp_dbh_t * imp_dbh, const char *savepoint) 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); @@ -3915,19 +3911,17 @@ int pg_db_release (SV * dbh, imp_dbh_t * imp_dbh, char * savepoint) 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);
Nice catches, fixed in r10862, will be part of 2.2.1


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.