From: Pierrick Charron Date: Tue, 26 Jul 2016 22:50:15 +0000 (-0400) Subject: Fixed bug #71709 X-Git-Tag: php-7.0.10RC1~41^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24d8f6ed7c583c82d6ed63080d235474f8afec6a;p=php Fixed bug #71709 When curl_setopt is called with an empty slist as value, we should not add the empty slist to the list of slist to free. --- diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 7e58c7f1e0..dc4a97197e 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2556,12 +2556,13 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC) } } - if (Z_REFCOUNT_P(ch->clone) <= 1) { - zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL); - } else { - zend_hash_next_index_insert(ch->to_free->slist, &slist, sizeof(struct curl_slist *), NULL); + if (slist) { + if (Z_REFCOUNT_P(ch->clone) <= 1) { + zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL); + } else { + zend_hash_next_index_insert(ch->to_free->slist, &slist, sizeof(struct curl_slist *), NULL); + } } - error = curl_easy_setopt(ch->cp, option, slist); break;