mirror of
https://github.com/curl/curl.git
synced 2026-01-26 15:03:21 +00:00
easy_getinfo: check magic, Curl_close safety
Check the easy handles magic in calls to curl_easy_getinfo(). In Curl_close() clear the magic after DNS shutdown since we'd like to see tracing for this. When clearing the magic, also clear the verbose flag so we no longer call DEBUGFUNCTION on such a handle. Closes #18511
This commit is contained in:
parent
f4758cd524
commit
80ac5fb2ec
@ -877,12 +877,16 @@ void curl_easy_cleanup(CURL *ptr)
|
||||
* information from a performed transfer and similar.
|
||||
*/
|
||||
#undef curl_easy_getinfo
|
||||
CURLcode curl_easy_getinfo(CURL *data, CURLINFO info, ...)
|
||||
CURLcode curl_easy_getinfo(CURL *easy, CURLINFO info, ...)
|
||||
{
|
||||
struct Curl_easy *data = easy;
|
||||
va_list arg;
|
||||
void *paramp;
|
||||
CURLcode result;
|
||||
|
||||
if(!GOOD_EASY_HANDLE(data))
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
|
||||
va_start(arg, info);
|
||||
paramp = va_arg(arg, void *);
|
||||
|
||||
|
||||
20
lib/url.c
20
lib/url.c
@ -258,13 +258,20 @@ CURLcode Curl_close(struct Curl_easy **datap)
|
||||
|
||||
Curl_expire_clear(data); /* shut off any timers left */
|
||||
|
||||
data->magic = 0; /* force a clear AFTER the possibly enforced removal from
|
||||
the multi handle, since that function uses the magic
|
||||
field! */
|
||||
|
||||
if(data->state.rangestringalloc)
|
||||
free(data->state.range);
|
||||
|
||||
/* release any resolve information this transfer kept */
|
||||
Curl_async_destroy(data);
|
||||
Curl_resolv_unlink(data, &data->state.dns[0]); /* done with this */
|
||||
Curl_resolv_unlink(data, &data->state.dns[1]);
|
||||
|
||||
data->set.verbose = FALSE; /* no more calls to DEBUGFUNCTION */
|
||||
data->magic = 0; /* force a clear AFTER the possibly enforced removal from
|
||||
* the multi handle and async dns shutdown. The multi
|
||||
* handle might check the magic and so might any
|
||||
* DEBUGFUNCTION invoked for tracing */
|
||||
|
||||
/* freed here just in case DONE was not called */
|
||||
Curl_req_free(&data->req, data);
|
||||
|
||||
@ -299,11 +306,6 @@ CURLcode Curl_close(struct Curl_easy **datap)
|
||||
Curl_safefree(data->info.contenttype);
|
||||
Curl_safefree(data->info.wouldredirect);
|
||||
|
||||
/* release any resolve information this transfer kept */
|
||||
Curl_async_destroy(data);
|
||||
Curl_resolv_unlink(data, &data->state.dns[0]); /* done with this */
|
||||
Curl_resolv_unlink(data, &data->state.dns[1]);
|
||||
|
||||
data_priority_cleanup(data);
|
||||
|
||||
/* No longer a dirty share, if it exists */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user