]> granicus.if.org Git - php/commitdiff
Don't lose track of exec() errors in pdo_sqlite2
authorIlia Alshanetsky <iliaa@php.net>
Wed, 21 Dec 2005 16:23:12 +0000 (16:23 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 21 Dec 2005 16:23:12 +0000 (16:23 +0000)
ext/sqlite/pdo_sqlite2.c

index 5efa99c8b148aa20464effdb516649a505751d52..df097234c2c33d33321a0c3b4753b904ed541052 100644 (file)
@@ -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 {