From: Michael Wallner Date: Tue, 14 Jul 2015 16:59:06 +0000 (+0200) Subject: fix resource leaks X-Git-Tag: RELEASE_3_0_0_RC1~40 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=523b05962853a285df30622a7cffbeeb89eaf2ae;p=m6w6%2Fext-http fix resource leaks --- diff --git a/php_http_message.c b/php_http_message.c index d61644c..a6b30f5 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -776,10 +776,11 @@ ZEND_RESULT_CODE php_http_message_object_set_body(php_http_message_object_t *msg } if (msg_obj->message) { php_http_message_body_free(&msg_obj->message->body); - msg_obj->message->body = php_http_message_body_init(&body_obj->body, NULL); + msg_obj->message->body = body_obj->body; } else { - msg_obj->message = php_http_message_init(NULL, 0, php_http_message_body_init(&body_obj->body, NULL)); + msg_obj->message = php_http_message_init(NULL, 0, body_obj->body); } + php_http_message_body_addref(body_obj->body); msg_obj->body = body_obj; return SUCCESS; diff --git a/php_http_message_body.c b/php_http_message_body.c index ab5b7ba..d629ae5 100644 --- a/php_http_message_body.c +++ b/php_http_message_body.c @@ -37,7 +37,7 @@ php_http_message_body_t *php_http_message_body_init(php_http_message_body_t **bo if (body_ptr && *body_ptr) { body = *body_ptr; - ++body->refcount; + php_http_message_body_addref(body); return body; }