-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
Description
I did this
When a request is made to a non-existent URL, the hostname in async_thrdd_init
is not properly cleaned up:
https://github.com/curl/curl/blame/master/lib/asyn-thrdd.c#L426
As a result, on subsequent requests, the old hostname value remains and is simply overwritten with the new one, without ever being freed. This leads to the previous hostname lingering in memory.
Sample for reproduction:
#include <stdio.h>
#include <curl/curl.h>
size_t ignore_output( void *ptr, size_t size, size_t nmemb, void *stream)
{
(void) ptr;
(void) stream;
return size * nmemb;
}
int main()
{
CURL *curl;
curl = curl_easy_init();
if(!curl) {
printf("curl initialization failed\n");
return -1;
}
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &ignore_output);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_URL, "invalid_url_one");
curl_easy_perform(curl);
curl_easy_setopt(curl, CURLOPT_URL, "invalid_url_two");
curl_easy_perform(curl);
curl_easy_cleanup(curl);
return 0;
}
I expected the following
No response
curl/libcurl version
curl 8.14.0
operating system
Linux