iliaa Mon Dec 19 16:33:46 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/pdo_sqlite sqlite_driver.c
Log:
Fixed possible memory corruption.
http://cvs.php.net/viewcvs.cgi/php-src/ext/pdo_sqlite/sqlite_driver.c?r1=1.20.2.2&r2=1.20.2.3&diff_format=u
Index: php-src/ext/pdo_sqlite/sqlite_driver.c
diff -u php-src/ext/pdo_sqlite/sqlite_driver.c:1.20.2.2
php-src/ext/pdo_sqlite/sqlite_driver.c:1.20.2.3
--- php-src/ext/pdo_sqlite/sqlite_driver.c:1.20.2.2 Tue Dec 6 02:25:28 2005
+++ php-src/ext/pdo_sqlite/sqlite_driver.c Mon Dec 19 16:33:46 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite_driver.c,v 1.20.2.2 2005/12/06 02:25:28 sniper Exp $ */
+/* $Id: sqlite_driver.c,v 1.20.2.3 2005/12/19 16:33:46 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