mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
fix bug #36898 (__set() leaks in classes extending internal ones)
Added: ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC) to initialize and destroy zend_object structs
This commit is contained in:
parent
697c652001
commit
59b8592c8c
18 changed files with 70 additions and 116 deletions
|
@ -802,8 +802,7 @@ static void sqlite_object_free_storage(void *object TSRMLS_DC)
|
|||
{
|
||||
sqlite_object *intern = (sqlite_object *)object;
|
||||
|
||||
zend_hash_destroy(intern->std.properties);
|
||||
FREE_HASHTABLE(intern->std.properties);
|
||||
zend_object_std_dtor(&intern->std TSRMLS_CC);
|
||||
|
||||
if (intern->u.ptr) {
|
||||
if (intern->type == is_db) {
|
||||
|
@ -826,10 +825,8 @@ static void sqlite_object_new(zend_class_entry *class_type, zend_object_handlers
|
|||
|
||||
intern = emalloc(sizeof(sqlite_object));
|
||||
memset(intern, 0, sizeof(sqlite_object));
|
||||
intern->std.ce = class_type;
|
||||
|
||||
ALLOC_HASHTABLE(intern->std.properties);
|
||||
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||
zend_hash_copy(intern->std.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) sqlite_object_free_storage, NULL TSRMLS_CC);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue