cvs: php-src(PHP_5_3) /ext/sqlite3 sqlite3.c

From: Date: Mon, 15 Sep 2008 00:55:38 +0000
Subject: cvs: php-src(PHP_5_3) /ext/sqlite3 sqlite3.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-53145@lists.php.net to get a copy of this message
scottmac Mon Sep 15 00:55:38 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/sqlite3 sqlite3.c Log: Fixed bug #46033 (Segfault when instantiating SQLite3Stmt and SQLite3Result) http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.1.2.10&r2=1.1.2.11&diff_format=u Index: php-src/ext/sqlite3/sqlite3.c diff -u php-src/ext/sqlite3/sqlite3.c:1.1.2.10 php-src/ext/sqlite3/sqlite3.c:1.1.2.11 --- php-src/ext/sqlite3/sqlite3.c:1.1.2.10 Tue Aug 12 13:37:32 2008 +++ php-src/ext/sqlite3/sqlite3.c Mon Sep 15 00:55:37 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sqlite3.c,v 1.1.2.10 2008/08/12 13:37:32 felipe Exp $ */ +/* $Id: sqlite3.c,v 1.1.2.11 2008/09/15 00:55:37 scottmac Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1626,7 +1626,9 @@ (int (*)(void *, void *)) php_sqlite3_compare_stmt_free); } - Z_DELREF_P(intern->db_obj_zval); + if (intern->db_obj_zval) { + Z_DELREF_P(intern->db_obj_zval); + } zend_object_std_dtor(&intern->zo TSRMLS_CC); efree(intern); @@ -1641,15 +1643,17 @@ return; } - if (intern->stmt_obj->initialised) { - sqlite3_reset(intern->stmt_obj->stmt); - } + if (intern->stmt_obj_zval) { + if (intern->stmt_obj->initialised) { + sqlite3_reset(intern->stmt_obj->stmt); + } - if (intern->is_prepared_statement == 0) { - zval_dtor(intern->stmt_obj_zval); - FREE_ZVAL(intern->stmt_obj_zval); - } else { - zval_ptr_dtor(&intern->stmt_obj_zval); + if (intern->is_prepared_statement == 0) { + zval_dtor(intern->stmt_obj_zval); + FREE_ZVAL(intern->stmt_obj_zval); + } else { + zval_ptr_dtor(&intern->stmt_obj_zval); + } } zend_object_std_dtor(&intern->zo TSRMLS_CC); @@ -1690,6 +1694,8 @@ intern = emalloc(sizeof(php_sqlite3_stmt)); memset(&intern->zo, 0, sizeof(php_sqlite3_stmt)); + intern->db_obj_zval = NULL; + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *)); @@ -1712,6 +1718,7 @@ intern->complete = 0; intern->is_prepared_statement = 0; + intern->stmt_obj_zval = NULL; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *));

« previous php.cvs (#53145) next »