summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2018-01-08 12:55:57 +0800
committerXinchen Hui <laruence@gmail.com>2018-01-08 12:56:08 +0800
commit4c3c7117e4624ea8e4ae20918b39714fb0235ca4 (patch)
tree3d47d3242abf5a5d42336403b5a4e26632445b5f /ext/curl
parent88b8cd7385c57791cc75128e84943316ec426584 (diff)
downloadphp-git-4c3c7117e4624ea8e4ae20918b39714fb0235ca4.tar.gz
remove false dup
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/multi.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/ext/curl/multi.c b/ext/curl/multi.c
index e78e15436a..707384f7e5 100644
--- a/ext/curl/multi.c
+++ b/ext/curl/multi.c
@@ -79,7 +79,6 @@ PHP_FUNCTION(curl_multi_add_handle)
zval *z_ch;
php_curlm *mh;
php_curl *ch;
- zval tmp_val;
CURLMcode error = CURLM_OK;
ZEND_PARSE_PARAMETERS_START(2,2)
@@ -97,10 +96,8 @@ PHP_FUNCTION(curl_multi_add_handle)
_php_curl_cleanup_handle(ch);
- /* we want to create a copy of this zval that we store in the multihandle structure element "easyh" */
- ZVAL_DUP(&tmp_val, z_ch);
-
- zend_llist_add_element(&mh->easyh, &tmp_val);
+ GC_ADDREF(Z_RES_P(z_ch));
+ zend_llist_add_element(&mh->easyh, z_ch);
error = curl_multi_add_handle(mh->multi, ch->cp);
SAVE_CURLM_ERROR(mh, error);
@@ -520,11 +517,8 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
} else if (!Z_ISUNDEF(retval)) {
if (CURL_PUSH_DENY != zval_get_long(&retval)) {
rval = CURL_PUSH_OK;
-
- /* we want to create a copy of this zval that we store in the multihandle structure element "easyh" */
- zval tmp_val;
- ZVAL_DUP(&tmp_val, &pz_ch);
- zend_llist_add_element(&mh->easyh, &tmp_val);
+ GC_ADDREF(Z_RES(pz_ch));
+ zend_llist_add_element(&mh->easyh, &pz_ch);
} else {
/* libcurl will free this easy handle, avoid double free */
ch->cp = NULL;
@@ -533,6 +527,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
return rval;
}
+/* }}} */
#endif