summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-29 14:28:43 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-29 14:28:43 +0000
commit59b8592c8cb51599147f990ad8b61d8d02cfce05 (patch)
tree9bf669097b48484400efe53cb52ff567c51ff8e7 /ext/sqlite/sqlite.c
parent697c652001257e04a5af0f047017fe20f62ee969 (diff)
downloadphp-git-59b8592c8cb51599147f990ad8b61d8d02cfce05.tar.gz
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
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 13633b8f8c..fb97233695 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -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);