mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
Fix leaking php_uv_t when its resource was closed before uv_close_cb invocation
This commit is contained in:
parent
e2cc81869e
commit
a4036293d9
5
php_uv.c
5
php_uv.c
@ -1327,6 +1327,7 @@ void static destruct_uv(zend_resource *rsrc)
|
||||
php_uv_t *obj;
|
||||
|
||||
obj = (php_uv_t *) rsrc->ptr;
|
||||
rsrc->ptr = NULL;
|
||||
if (obj == NULL || obj->in_free == -1) {
|
||||
return;
|
||||
}
|
||||
@ -2154,7 +2155,9 @@ static void php_uv_close_cb(uv_handle_t *handle)
|
||||
PHP_UV_DEBUG_RESOURCE_REFCOUNT(uv_close_cb, uv->resource_id);
|
||||
|
||||
uv->in_free = -2;
|
||||
zend_list_close(uv->resource_id); /* call destruct_uv */
|
||||
uv->resource_id->type = -1; /* fake zend_list_close() as we need to call destruct_uv() in *any* case, even if reverse destroy already closed it */
|
||||
uv->resource_id->ptr = uv;
|
||||
destruct_uv(uv->resource_id);
|
||||
|
||||
zval_ptr_dtor(¶ms[0]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user