diff --git a/ext/curl/curl_private.h b/ext/curl/curl_private.h index 19e43094574de..8e8e9586db587 100644 --- a/ext/curl/curl_private.h +++ b/ext/curl/curl_private.h @@ -89,7 +89,7 @@ struct _php_curl_send_headers { struct _php_curl_free { zend_llist post; zend_llist stream; - HashTable *slist; + HashTable slist; }; typedef struct { diff --git a/ext/curl/interface.c b/ext/curl/interface.c index e47c9c43bc8a9..9b6cb1abdc911 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1143,8 +1143,7 @@ void init_curl_handle(php_curl *ch) zend_llist_init(&ch->to_free->post, sizeof(struct HttpPost *), (llist_dtor_func_t)curl_free_post, 0); zend_llist_init(&ch->to_free->stream, sizeof(struct mime_data_cb_arg *), (llist_dtor_func_t)curl_free_cb_arg, 0); - ch->to_free->slist = emalloc(sizeof(HashTable)); - zend_hash_init(ch->to_free->slist, 4, NULL, curl_free_slist, 0); + zend_hash_init(&ch->to_free->slist, 4, NULL, curl_free_slist, 0); ZVAL_UNDEF(&ch->postfields); } @@ -1312,7 +1311,6 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source) ZVAL_COPY(&ch->private_data, &source->private_data); - efree(ch->to_free->slist); efree(ch->to_free); ch->to_free = source->to_free; efree(ch->clone); @@ -2160,9 +2158,9 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue if (slist) { if ((*ch->clone) == 1) { - zend_hash_index_update_ptr(ch->to_free->slist, option, slist); + zend_hash_index_update_ptr(&ch->to_free->slist, option, slist); } else { - zend_hash_next_index_insert_ptr(ch->to_free->slist, slist); + zend_hash_next_index_insert_ptr(&ch->to_free->slist, slist); } } @@ -2803,8 +2801,7 @@ static void curl_free_obj(zend_object *object) zend_llist_clean(&ch->to_free->post); zend_llist_clean(&ch->to_free->stream); - zend_hash_destroy(ch->to_free->slist); - efree(ch->to_free->slist); + zend_hash_destroy(&ch->to_free->slist); efree(ch->to_free); efree(ch->clone); }