easy_getinfo: check magic, Curl_close safety
No binary (build failed)
—
(log yok)
| @@ -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 *); | |
| @@ -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 */ | |