1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-08 14:48:32 -04:00

savepv and free unprepared_statements attribute when necessary, to fix #11 (Grinnz++)

This commit is contained in:
Kenichi Ishigaki 2015-07-30 00:27:24 +09:00
parent 348ca9afb5
commit 01123b1321

View file

@ -895,10 +895,12 @@ sqlite_st_prepare_sv(SV *sth, imp_sth_t *imp_sth, SV *sv_statement, SV *attribs)
}
return FALSE; /* -> undef in lib/DBD/SQLite.pm */
}
if (&extra) {
imp_sth->unprepared_statements = extra;
if (&extra && imp_dbh->allow_multiple_statements) {
imp_sth->unprepared_statements = savepv(extra);
}
else {
if (imp_dbh->allow_multiple_statements)
Safefree(imp_sth->unprepared_statements);
imp_sth->unprepared_statements = NULL;
}
/* Add the statement to the front of the list to keep track of
@ -1295,6 +1297,8 @@ sqlite_st_destroy(SV *sth, imp_sth_t *imp_sth)
imp_sth->stmt = NULL;
}
}
if (imp_dbh->allow_multiple_statements)
Safefree(imp_sth->unprepared_statements);
SvREFCNT_dec((SV*)imp_sth->params);
SvREFCNT_dec((SV*)imp_sth->col_types);
DBIc_IMPSET_off(imp_sth);