title: curl_slist->next is never null so while loop gets stuck
body: <p>I am working on a C++ library that does an API request using curl. I'm having an issue where I am trying to process the cookies that are returned in the response using <code>curl_slist</code> and <code>curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &amp;cookies);</code>. </p>
  
  <p>It looks like its a linked list so I have a current and next attributes and I'm checking when next is NULL I should break out of the loop but for some reason its getting stuck in the loop, looks like its doing the same cookie over and over again but can't see why. </p>
  
  <pre><code>struct curl_slist* cookies;
  curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &amp;cookies);
  
  int i = 1;
  std::vector&lt;CookieObj&gt; cookieObjects;
  struct curl_slist* current = cookies;
  if (current != NULL)
  {
      string cookieString = string(current-&gt;data);
      CookieObj cookieObj = storeCookie(cookieString);
      cookieObjects.push_back(cookieObj);
  
      while (current-&gt;next != NULL)
      {
          string cookieString = string(current-&gt;data);
          CookieObj cookieObj = this-&gt;storeCookie(cookieString);
          cookieObjects.push_back(cookieObj);
          current = cookies-&gt;next;
  
          i++;
      }
  </code></pre>