]> granicus.if.org Git - php/commitdiff
Fixed bug #71709
authorPierrick Charron <pierrick@php.net>
Tue, 26 Jul 2016 22:50:15 +0000 (18:50 -0400)
committerPierrick Charron <pierrick@php.net>
Tue, 26 Jul 2016 22:50:15 +0000 (18:50 -0400)
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.

ext/curl/interface.c

index 7e58c7f1e05ba703630fcac2006f7e2de95d832f..dc4a97197eb76852f6c8deff159eda14c6f5740d 100644 (file)
@@ -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;