From: Michael Wallner Date: Wed, 27 Jul 2016 12:54:56 +0000 (+0200) Subject: fix messagebody gc/refcount X-Git-Tag: RELEASE_3_1_0_BETA1~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a651c2f69a88b90c392fcc8f29564b4d72a1e683;p=m6w6%2Fext-http fix messagebody gc/refcount --- diff --git a/src/php_http_message_body.c b/src/php_http_message_body.c index 3ab57f2..18859a3 100644 --- a/src/php_http_message_body.c +++ b/src/php_http_message_body.c @@ -46,10 +46,11 @@ php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **bo if (stream) { body->res = stream->res; + ++GC_REFCOUNT(body->res); } else { body->res = php_stream_temp_create(TEMP_STREAM_DEFAULT, 0xffff)->res; } - ++GC_REFCOUNT(body->res); + php_stream_auto_cleanup(php_http_message_body_stream(body)); if (body_ptr) { *body_ptr = body; @@ -91,6 +92,7 @@ void php_http_message_body_free(php_http_message_body_t **body_ptr) php_http_message_body_t *body = *body_ptr; if (!--body->refcount) { + zend_list_delete(body->res); PTR_FREE(body->boundary); efree(body); }