iliaa Mon Dec 19 16:34:00 2005 EDT Modified files: /php-src/ext/pdo_sqlite sqlite_driver.c Log: MFB51: Fixed possible memory corruption. http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_sqlite/sqlite_driver.c?r1=1.25&r2=1.26&diff_format=u Index: php-src/ext/pdo_sqlite/sqlite_driver.c diff -u php-src/ext/pdo_sqlite/sqlite_driver.c:1.25 php-src/ext/pdo_sqlite/sqlite_driver.c:1.26 --- php-src/ext/pdo_sqlite/sqlite_driver.c:1.25 Tue Dec 6 02:24:43 2005 +++ php-src/ext/pdo_sqlite/sqlite_driver.c Mon Dec 19 16:34:00 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sqlite_driver.c,v 1.25 2005/12/06 02:24:43 sniper Exp $ */ +/* $Id: sqlite_driver.c,v 1.26 2005/12/19 16:34:00 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -42,7 +42,10 @@ einfo->line = line; if (einfo->errcode != SQLITE_OK) { - einfo->errmsg = (char*)sqlite3_errmsg(H->db); + if (einfo->errmsg) { + efree(einfo->errmsg); + } + einfo->errmsg = estrdup((char*)sqlite3_errmsg(H->db)); } else { /* no error */ strcpy(*pdo_err, PDO_ERR_NONE); return 0; @@ -133,11 +136,17 @@ pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data; if (H) { + pdo_sqlite_error_info *einfo = &H->einfo; + pdo_sqlite_cleanup_callbacks(H TSRMLS_CC); if (H->db) { sqlite3_close(H->db); H->db = NULL; } + if (einfo->errmsg) { + efree(einfo->errmsg); + einfo->errmsg = NULL; + } pefree(H, dbh->is_persistent); dbh->driver_data = NULL; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php