cvs: php4 /ext/standard user_filters.c

From: Date: Mon, 21 Apr 2003 18:43:36 +0000
Subject: cvs: php4 /ext/standard user_filters.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20418@lists.php.net to get a copy of this message
moriyoshi Mon Apr 21 14:43:36 2003 EDT Modified files: /php4/ext/standard user_filters.c Log: Reduced leaks in userland filters Index: php4/ext/standard/user_filters.c diff -u php4/ext/standard/user_filters.c:1.13 php4/ext/standard/user_filters.c:1.14 --- php4/ext/standard/user_filters.c:1.13 Thu Apr 17 19:59:28 2003 +++ php4/ext/standard/user_filters.c Mon Apr 21 14:43:36 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: user_filters.c,v 1.13 2003/04/17 23:59:28 pollita Exp $ */ +/* $Id: user_filters.c,v 1.14 2003/04/21 18:43:36 moriyoshi Exp $ */ /* * TODO: Rewrite for buckets. @@ -141,7 +141,7 @@ if (retval) zval_ptr_dtor(&retval); - if (SUCCESS == zend_hash_find(Z_OBJPROP_P(obj), "filter", 6, (void**)&tmp)) { + if (SUCCESS == zend_hash_find(Z_OBJPROP_P(obj), "filter", sizeof("filter"), (void**)&tmp)) { zend_list_delete(Z_LVAL_PP(tmp)); FREE_ZVAL(*tmp); } @@ -167,21 +167,23 @@ zval *zclosing, *zconsumed, *zin, *zout, *zstream; int call_result; - if (FAILURE == zend_hash_find(Z_OBJPROP_P(obj), "stream", 7, (void**)&zstream)) { + if (FAILURE == zend_hash_find(Z_OBJPROP_P(obj), "stream", sizeof("stream"), (void**)&zstream)) { /* Give the userfilter class a hook back to the stream */ - ALLOC_ZVAL(zstream); + ALLOC_INIT_ZVAL(zstream); ZEND_REGISTER_RESOURCE(zstream, stream, le_stream); add_property_zval(obj, "stream", zstream); + /* add_property_zval increments the refcount which is unwanted here */ + zval_ptr_dtor(&zstream); } ZVAL_STRINGL(&func_name, "filter", sizeof("filter")-1, 0); /* Setup calling arguments */ - ALLOC_ZVAL(zin); + ALLOC_INIT_ZVAL(zin); ZEND_REGISTER_RESOURCE(zin, buckets_in, le_bucket_brigade); args[0] = &zin; - ALLOC_ZVAL(zout); + ALLOC_INIT_ZVAL(zout); ZEND_REGISTER_RESOURCE(zout, buckets_out, le_bucket_brigade); args[1] = &zout; @@ -343,6 +345,8 @@ ZEND_REGISTER_RESOURCE(zbucket, bucket, le_bucket); object_init(return_value); add_property_zval(return_value, "bucket", zbucket); + /* add_property_zval increments the refcount which is unwanted here */ + zval_ptr_dtor(&zbucket); add_property_stringl(return_value, "data", bucket->buf, bucket->buflen, 1); add_property_long(return_value, "datalen", bucket->buflen); }

« previous php.cvs (#20418) next »