Re: com php-src: Remove delref in free_object_storage: Zend/zend_objects_API.c

From: Date: Wed, 16 Oct 2019 11:56:25 +0000
Subject: Re: com php-src: Remove delref in free_object_storage: Zend/zend_objects_API.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108929@lists.php.net to get a copy of this message
Hi Nikita! The commit below causes a leak in 7.4 with code from: https://github.com/m6w6/ext-http/blob/master/src/php_http_querystring.c#L380-L392 Is this intentional? Thanks, Mike On 28/08/2019 17:04, Nikita Popov wrote: > Commit: c45f19590c4d442c0ecf5a3b55cd0fb928243e6a > Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 28 Aug 2019 15:35:53 +0200 > Parents: 2709d6a2508abfdda1b84f0426ae644c703180ed > Branches: PHP-7.4 master > > Link: > http://git.php.net/?p=php-src.git;a=commitdiff;h=c45f19590c4d442c0ecf5a3b55cd0fb928243e6a > > Log: > Remove delref in free_object_storage > > This gives us better object leak diagnostics. > > Changed paths: > M Zend/zend_objects_API.c > > > Diff: > diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c > index 7c5d44a..80359b5 100644 > --- a/Zend/zend_objects_API.c > +++ b/Zend/zend_objects_API.c > @@ -87,7 +87,8 @@ ZEND_API void ZEND_FASTCALL > zend_objects_store_free_object_storage(zend_objects_ > return; > } > > - /* Free object contents, but don't free objects themselves, so they show up as leaks */ > + /* Free object contents, but don't free objects themselves, so they show up as leaks. > + * Also add a ref to all objects, so the object can't be freed by something else later. > */ > end = objects->object_buckets + 1; > obj_ptr = objects->object_buckets + objects->top; > > @@ -101,7 +102,6 @@ ZEND_API void ZEND_FASTCALL > zend_objects_store_free_object_storage(zend_objects_ > if (obj->handlers->free_obj != zend_object_std_dtor) { > GC_ADDREF(obj); > obj->handlers->free_obj(obj); > - GC_DELREF(obj); > } > } > } > @@ -115,7 +115,6 @@ ZEND_API void ZEND_FASTCALL > zend_objects_store_free_object_storage(zend_objects_ > GC_ADD_FLAGS(obj, IS_OBJ_FREE_CALLED); > GC_ADDREF(obj); > obj->handlers->free_obj(obj); > - GC_DELREF(obj); > } > } > } while (obj_ptr != end); > > -- Regards, Mike

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.cvs (#108929) next »