Author: turnstep
Date: Sat Mar 26 13:04:28 2011
New Revision: 14774
Modified:
DBD-Pg/trunk/Changes
DBD-Pg/trunk/dbdimp.c
Log:
Fix for bug 65734: memory leak when binding arrays. Switched to a Copy(), and
forcibly mortalize the SV
Modified: DBD-Pg/trunk/Changes
==============================================================================
--- DBD-Pg/trunk/Changes (original)
+++ DBD-Pg/trunk/Changes Sat Mar 26 13:04:28 2011
@@ -7,6 +7,7 @@
2.18.0
+ - Fix memory leak when binding arrays [GSM] (CPAN bug #65734)
- Fix memory leak with ParamValues. [Martin J. Evans] (CPAN bug #60863)
- New cancel() method per DBI spec. [Eric Simon] (CPAN bug #63516)
- Fix memory leak in handle_old_async (missing PQclear)
Modified: DBD-Pg/trunk/dbdimp.c
==============================================================================
--- DBD-Pg/trunk/dbdimp.c (original)
+++ DBD-Pg/trunk/dbdimp.c Sat Mar 26 13:04:28 2011
@@ -2278,8 +2278,10 @@
quotedval =
pg_stringify_array(newvalue,",",imp_dbh->pg_server_version, 0);
currph->valuelen = sv_len(quotedval);
Renew(currph->value, currph->valuelen+1, char); /*
freed in dbd_st_destroy */
- currph->value = SvUTF8(quotedval) ?
SvPVutf8_nolen(quotedval) : SvPV_nolen(quotedval);
+ Copy(SvUTF8(quotedval) ? SvPVutf8_nolen(quotedval) :
SvPV_nolen(quotedval),
+ currph->value, currph->valuelen+1, char);
currph->bind_type = pg_type_data(PG_CSTRINGARRAY);
+ sv_2mortal(quotedval);
is_array = DBDPG_TRUE;
}
else {