summaryrefslogtreecommitdiff
path: root/ext/sqlite/pdo_sqlite2.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-12-21 16:23:12 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-12-21 16:23:12 +0000
commit8710b8c5f5ce36542432a913750942cbbf48e6c6 (patch)
tree76c8b4301bfa01d921254fa17aaa55f4ca3b2580 /ext/sqlite/pdo_sqlite2.c
parentd09ad216a01264b6c63427c76077c0b4f286365b (diff)
downloadphp-git-8710b8c5f5ce36542432a913750942cbbf48e6c6.tar.gz
Don't lose track of exec() errors in pdo_sqlite2
Diffstat (limited to 'ext/sqlite/pdo_sqlite2.c')
-rw-r--r--ext/sqlite/pdo_sqlite2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/sqlite/pdo_sqlite2.c b/ext/sqlite/pdo_sqlite2.c
index 5efa99c8b1..df097234c2 100644
--- a/ext/sqlite/pdo_sqlite2.c
+++ b/ext/sqlite/pdo_sqlite2.c
@@ -326,6 +326,10 @@ static int sqlite2_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */
sqlite_close(H->db);
H->db = NULL;
}
+ if (H->einfo.errmsg) {
+ pefree(H->einfo.errmsg, dbh->is_persistent);
+ H->einfo.errmsg = NULL;
+ }
pefree(H, dbh->is_persistent);
dbh->driver_data = NULL;
}
@@ -357,7 +361,7 @@ static long sqlite2_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TS
pdo_sqlite2_db_handle *H = (pdo_sqlite2_db_handle *)dbh->driver_data;
char *errmsg = NULL;
- if (sqlite_exec(H->db, sql, NULL, NULL, &errmsg) != SQLITE_OK) {
+ if ((H->einfo.errcode = sqlite_exec(H->db, sql, NULL, NULL, &errmsg)) != SQLITE_OK) {
pdo_sqlite2_error(errmsg, dbh);
return -1;
} else {