- http_request_body_free() should only accept a ptr_ptr
authorMichael Wallner <mike@php.net>
Thu, 8 Dec 2005 21:59:28 +0000 (21:59 +0000)
committerMichael Wallner <mike@php.net>
Thu, 8 Dec 2005 21:59:28 +0000 (21:59 +0000)
http_request_api.c
http_request_pool_api.c
php_http_request_api.h

index e9d39d7c0425ab7e8b5ac4495c6553249d32afb8..f02aa18ff91c500e1477809f616767ba10c79ab8 100644 (file)
@@ -374,11 +374,12 @@ PHP_HTTP_API void _http_request_body_dtor(http_request_body *body TSRMLS_DC)
 /* }}} */
 
 /* {{{ void http_request_body_free(http_request_body *) */
-PHP_HTTP_API void _http_request_body_free(http_request_body *body TSRMLS_DC)
+PHP_HTTP_API void _http_request_body_free(http_request_body **body TSRMLS_DC)
 {
-       if (body) {
-               http_request_body_dtor(body);
-               efree(body);
+       if (*body) {
+               http_request_body_dtor(*body);
+               efree(*body);
+               *body = NULL;
        }
 }
 /* }}} */
index 48cf18c4a8cc76f1af29c3f59fb76eb055f6a161..2a297d680f0f4a71a8757c473f515d1c31d7f791 100644 (file)
@@ -384,8 +384,9 @@ void _http_request_pool_wrap_exception(zval *old_exception, zval *new_exception
 static void http_request_pool_freebody(http_request_callback_ctx **body)
 {
        HTTP_REQUEST_CALLBACK_DATA(*body, http_request_body *, b);
-       http_request_body_free(b);
+       http_request_body_free(&b);
        efree(*body);
+       *body = NULL;
 }
 /* }}} */
 
index 7d9a4c705cad0cdab54a9b94596216e869e65f62..2da5f2282eaf93c4169568efe19205b032203705 100644 (file)
@@ -80,7 +80,7 @@ PHP_HTTP_API STATUS _http_request_body_fill(http_request_body *body, HashTable *
 PHP_HTTP_API void _http_request_body_dtor(http_request_body *body TSRMLS_DC);
 
 #define http_request_body_free(b) _http_request_body_free((b) TSRMLS_CC)
-PHP_HTTP_API void _http_request_body_free(http_request_body *body TSRMLS_DC);
+PHP_HTTP_API void _http_request_body_free(http_request_body **body TSRMLS_DC);
 
 #define http_request_init(ch, meth, url, body, options) _http_request_init((ch), (meth), (url), (body), (options) TSRMLS_CC)
 PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char *url, http_request_body *body, HashTable *options TSRMLS_DC);