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

index 8723ae6441c9e07a5f4b1fbbc3af5d97ef8e02c8..648e10789bddf7f637d98a9df468c80651d250f5 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 {