1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00

Fixed bug #38019 (segfault extending mysqli class)

This commit is contained in:
Dmitry Stogov
2006-07-10 10:05:20 +00:00
parent 795a482a48
commit 690e86fdb2
2 changed files with 17 additions and 6 deletions
+1
View File
@@ -82,6 +82,7 @@ PHP NEWS
- Fixed memory leaks in openssl streams context options. (Pierre)
- Fixed handling of extremely long paths inside tempnam() function. (Ilia)
- Fixed bug #38019 (segfault extending mysqli class). (Dmitry)
- Fixed bug #38005 (SoapFault faultstring doesn't follow encoding rules).
(Dmitry)
- Fixed bug #38004 (Parameters in SoapServer are decoded twice). (Dmitry)
+16 -6
View File
@@ -132,13 +132,15 @@ void php_clear_mysql(MY_MYSQL *mysql) {
}
/* }}} */
/* {{{ mysqli_objects_free_storage
/* {{{ mysqli_objects_destroy_object
*/
static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
static void mysqli_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
{
mysqli_object *intern = (mysqli_object *)object;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern->ptr;
zend_objects_destroy_object(object, handle TSRMLS_CC);
/* link object */
if (instanceof_function(intern->zo.ce, mysqli_link_class_entry TSRMLS_CC)) {
if (my_res && my_res->ptr) {
@@ -164,9 +166,17 @@ static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
php_clear_warnings((MYSQLI_WARNING *)my_res->info);
}
}
intern->ptr = NULL;
my_efree(my_res);
}
/* }}} */
/* {{{ mysqli_objects_free_storage
*/
static void mysqli_objects_free_storage(zend_object *object TSRMLS_DC)
{
mysqli_object *intern = (mysqli_object *)object;
MYSQLI_RESOURCE *my_res = (MYSQLI_RESOURCE *)intern->ptr;
my_efree(my_res);
zend_object_std_dtor(&intern->zo TSRMLS_CC);
efree(intern);
}
@@ -351,7 +361,7 @@ PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry *class_
zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,
(void *) &tmp, sizeof(zval *));
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL TSRMLS_CC);
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) mysqli_objects_destroy_object, (zend_objects_free_object_storage_t) mysqli_objects_free_storage, NULL TSRMLS_CC);
retval.handlers = &mysqli_object_handlers;
return retval;