@@ -141,7 +141,7 @@ static void userfilter_dtor(php_stream_filter *thisfilter TSRMLS_DC)
141
141
if (retval )
142
142
zval_ptr_dtor (& retval );
143
143
144
- if (SUCCESS == zend_hash_find (Z_OBJPROP_P (obj ), "filter" , 6 , (void * * )& tmp )) {
144
+ if (SUCCESS == zend_hash_find (Z_OBJPROP_P (obj ), "filter" , sizeof ( "filter" ) , (void * * )& tmp )) {
145
145
zend_list_delete (Z_LVAL_PP (tmp ));
146
146
FREE_ZVAL (* tmp );
147
147
}
@@ -167,21 +167,23 @@ php_stream_filter_status_t userfilter_filter(
167
167
zval * zclosing , * zconsumed , * zin , * zout , * zstream ;
168
168
int call_result ;
169
169
170
- if (FAILURE == zend_hash_find (Z_OBJPROP_P (obj ), "stream" , 7 , (void * * )& zstream )) {
170
+ if (FAILURE == zend_hash_find (Z_OBJPROP_P (obj ), "stream" , sizeof ( "stream" ) , (void * * )& zstream )) {
171
171
/* Give the userfilter class a hook back to the stream */
172
- ALLOC_ZVAL (zstream );
172
+ ALLOC_INIT_ZVAL (zstream );
173
173
ZEND_REGISTER_RESOURCE (zstream , stream , le_stream );
174
174
add_property_zval (obj , "stream" , zstream );
175
+ /* add_property_zval increments the refcount which is unwanted here */
176
+ zval_ptr_dtor (& zstream );
175
177
}
176
178
177
179
ZVAL_STRINGL (& func_name , "filter" , sizeof ("filter" )- 1 , 0 );
178
180
179
181
/* Setup calling arguments */
180
- ALLOC_ZVAL (zin );
182
+ ALLOC_INIT_ZVAL (zin );
181
183
ZEND_REGISTER_RESOURCE (zin , buckets_in , le_bucket_brigade );
182
184
args [0 ] = & zin ;
183
185
184
- ALLOC_ZVAL (zout );
186
+ ALLOC_INIT_ZVAL (zout );
185
187
ZEND_REGISTER_RESOURCE (zout , buckets_out , le_bucket_brigade );
186
188
args [1 ] = & zout ;
187
189
@@ -343,6 +345,8 @@ PHP_FUNCTION(stream_bucket_make_writeable)
343
345
ZEND_REGISTER_RESOURCE (zbucket , bucket , le_bucket );
344
346
object_init (return_value );
345
347
add_property_zval (return_value , "bucket" , zbucket );
348
+ /* add_property_zval increments the refcount which is unwanted here */
349
+ zval_ptr_dtor (& zbucket );
346
350
add_property_stringl (return_value , "data" , bucket -> buf , bucket -> buflen , 1 );
347
351
add_property_long (return_value , "datalen" , bucket -> buflen );
348
352
}
0 commit comments