]> granicus.if.org Git - php/commitdiff
remove false dup
authorXinchen Hui <laruence@gmail.com>
Mon, 8 Jan 2018 04:55:57 +0000 (12:55 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 8 Jan 2018 04:56:08 +0000 (12:56 +0800)
ext/curl/multi.c

index e78e15436a5d9d2587b0618a5d9707912831348c..707384f7e545aca96f394e3b83979ec1eaf5665b 100644 (file)
@@ -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