mirror of https://github.com/moparisthebest/curl
constify 'hostname' in init_thread_sync_data(). Simply clear
the whole 'tsd' structure on exit in destroy_thread_sync_data().
This commit is contained in:
parent
03bc2d34da
commit
1dcb99f0f7
|
@ -179,28 +179,21 @@ struct thread_sync_data {
|
||||||
static
|
static
|
||||||
void destroy_thread_sync_data(struct thread_sync_data * tsd)
|
void destroy_thread_sync_data(struct thread_sync_data * tsd)
|
||||||
{
|
{
|
||||||
if (tsd->hostname) {
|
if (tsd->hostname)
|
||||||
free(tsd->hostname);
|
free(tsd->hostname);
|
||||||
tsd->hostname = NULL;
|
if (tsd->event_terminate)
|
||||||
}
|
|
||||||
if (tsd->event_terminate) {
|
|
||||||
CloseHandle(tsd->event_terminate);
|
CloseHandle(tsd->event_terminate);
|
||||||
tsd->event_terminate = NULL;
|
if (tsd->mutex_terminate)
|
||||||
}
|
|
||||||
if (tsd->mutex_terminate) {
|
|
||||||
CloseHandle(tsd->mutex_terminate);
|
CloseHandle(tsd->mutex_terminate);
|
||||||
tsd->mutex_terminate = NULL;
|
if (tsd->mutex_waiting)
|
||||||
}
|
|
||||||
if (tsd->mutex_waiting) {
|
|
||||||
CloseHandle(tsd->mutex_waiting);
|
CloseHandle(tsd->mutex_waiting);
|
||||||
tsd->mutex_waiting = NULL;
|
memset(tsd,0,sizeof(*tsd));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize resolver thread synchronization data */
|
/* Initialize resolver thread synchronization data */
|
||||||
static
|
static
|
||||||
BOOL init_thread_sync_data(struct thread_data * td,
|
BOOL init_thread_sync_data(struct thread_data * td,
|
||||||
char * hostname,
|
const char * hostname,
|
||||||
struct thread_sync_data * tsd)
|
struct thread_sync_data * tsd)
|
||||||
{
|
{
|
||||||
HANDLE curr_proc = GetCurrentProcess();
|
HANDLE curr_proc = GetCurrentProcess();
|
||||||
|
@ -293,6 +286,7 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
|
||||||
* due to a resolver timeout.
|
* due to a resolver timeout.
|
||||||
*/
|
*/
|
||||||
struct thread_sync_data tsd = { 0,0,0,NULL };
|
struct thread_sync_data tsd = { 0,0,0,NULL };
|
||||||
|
|
||||||
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
|
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
|
||||||
/* thread synchronization data initialization failed */
|
/* thread synchronization data initialization failed */
|
||||||
return (unsigned)-1;
|
return (unsigned)-1;
|
||||||
|
@ -353,6 +347,7 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
|
||||||
* due to a resolver timeout.
|
* due to a resolver timeout.
|
||||||
*/
|
*/
|
||||||
struct thread_sync_data tsd = { 0,0,0,NULL };
|
struct thread_sync_data tsd = { 0,0,0,NULL };
|
||||||
|
|
||||||
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
|
if (!init_thread_sync_data(td, conn->async.hostname, &tsd)) {
|
||||||
/* thread synchronization data initialization failed */
|
/* thread synchronization data initialization failed */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue