From 4c3c7117e4624ea8e4ae20918b39714fb0235ca4 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 8 Jan 2018 12:55:57 +0800 Subject: [PATCH] remove false dup --- ext/curl/multi.c | 15 +++++---------- 1 file 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 -- 2.40.0