From: Ilia Alshanetsky Date: Wed, 21 Dec 2005 16:23:12 +0000 (+0000) Subject: Don't lose track of exec() errors in pdo_sqlite2 X-Git-Tag: php-5.1.2RC1~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8710b8c5f5ce36542432a913750942cbbf48e6c6;p=php Don't lose track of exec() errors in pdo_sqlite2 --- 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 {