summaryrefslogtreecommitdiff
path: root/ext/curl/interface.c
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-11-16 14:18:59 +0000
committerJani Taskinen <jani@php.net>2007-11-16 14:18:59 +0000
commitfc5d24284fa2a164b9aff51b19ec55a798bac1da (patch)
treee2949349b866fc92e68ed0c3888a42fa98de9313 /ext/curl/interface.c
parent113ab1bc793aaf623781de3ea4a45645898089ec (diff)
downloadphp-git-fc5d24284fa2a164b9aff51b19ec55a798bac1da.tar.gz
- Fixed bug #43092 (curl_copy_handle() crashes with > 32 chars long URL)
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r--ext/curl/interface.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 57467ffc19..d1f15ba6f1 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1076,9 +1076,9 @@ static void alloc_curl_handle(php_curl **ch)
memset(&(*ch)->err, 0, sizeof((*ch)->err));
- zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (void(*)(void *)) curl_free_string, 0);
- zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (void(*)(void *)) curl_free_slist, 0);
- zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (void(*)(void *)) curl_free_post, 0);
+ zend_llist_init(&(*ch)->to_free.str, sizeof(char *), (llist_dtor_func_t) curl_free_string, 0);
+ zend_llist_init(&(*ch)->to_free.slist, sizeof(struct curl_slist), (llist_dtor_func_t) curl_free_slist, 0);
+ zend_llist_init(&(*ch)->to_free.post, sizeof(struct HttpPost), (llist_dtor_func_t) curl_free_post, 0);
}
/* }}} */
@@ -1210,6 +1210,8 @@ PHP_FUNCTION(curl_copy_handle)
curl_easy_setopt(dupch->cp, CURLOPT_WRITEHEADER, (void *) dupch);
zend_llist_copy(&dupch->to_free.str, &ch->to_free.str);
+ /* Don't try to free copied strings, they're free'd when the original handle is destroyed */
+ dupch->to_free.str.dtor = NULL;
zend_llist_copy(&dupch->to_free.slist, &ch->to_free.slist);
zend_llist_copy(&dupch->to_free.post, &ch->to_free.post);