1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

attempt to fix or allow further detection of an elusive icc SIGSEGV

This commit is contained in:
Yang Tse 2008-10-19 20:17:16 +00:00
parent 80d0dcc9a3
commit 5779283a52
7 changed files with 21 additions and 3 deletions

View File

@ -502,9 +502,12 @@ CURLcode curl_easy_perform(CURL *curl)
/* global dns cache was requested but still isn't */ /* global dns cache was requested but still isn't */
struct curl_hash *ptr; struct curl_hash *ptr;
if(data->dns.hostcachetype == HCACHE_PRIVATE) if(data->dns.hostcachetype == HCACHE_PRIVATE) {
/* if the current cache is private, kill it first */ /* if the current cache is private, kill it first */
Curl_hash_destroy(data->dns.hostcache); Curl_hash_destroy(data->dns.hostcache);
data->dns.hostcachetype = HCACHE_NONE;
data->dns.hostcache = NULL;
}
ptr = Curl_global_host_cache_init(); ptr = Curl_global_host_cache_init();
if(ptr) { if(ptr) {

View File

@ -44,6 +44,7 @@ hash_element_dtor(void *user, void *element)
h->dtor(e->ptr); h->dtor(e->ptr);
memset(e, 0, sizeof(struct curl_hash_element));
free(e); free(e);
} }
@ -232,6 +233,7 @@ Curl_hash_clean(struct curl_hash *h)
for (i = 0; i < h->slots; ++i) { for (i = 0; i < h->slots; ++i) {
Curl_llist_destroy(h->table[i], (void *) h); Curl_llist_destroy(h->table[i], (void *) h);
h->table[i] = NULL;
} }
free(h->table); free(h->table);
@ -269,6 +271,8 @@ Curl_hash_destroy(struct curl_hash *h)
return; return;
Curl_hash_clean(h); Curl_hash_clean(h);
memset(h, 0, sizeof(struct struct curl_hash));
free(h); free(h);
} }

View File

@ -695,6 +695,7 @@ static void freednsentry(void *freethis)
Curl_freeaddrinfo(p->addr); Curl_freeaddrinfo(p->addr);
memset(p, 0, sizeof(struct Curl_dns_entry));
free(p); free(p);
} }

View File

@ -113,6 +113,8 @@ Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
} }
list->dtor(user, e->ptr); list->dtor(user, e->ptr);
memset(e, 0, sizeof(struct curl_llist_element));
free(e); free(e);
--list->size; --list->size;
@ -126,6 +128,7 @@ Curl_llist_destroy(struct curl_llist *list, void *user)
while(list->size > 0) while(list->size > 0)
Curl_llist_remove(list, list->tail, user); Curl_llist_remove(list, list->tail, user);
memset(list, 0, sizeof(struct curl_llist));
free(list); free(list);
} }
} }

View File

@ -1551,6 +1551,8 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
multi->type = 0; /* not good anymore */ multi->type = 0; /* not good anymore */
Curl_hash_destroy(multi->hostcache); Curl_hash_destroy(multi->hostcache);
Curl_hash_destroy(multi->sockhash); Curl_hash_destroy(multi->sockhash);
multi->hostcache = NULL;
multi->sockhash = NULL;
/* go over all connections that have close actions */ /* go over all connections that have close actions */
for(i=0; i< multi->connc->num; i++) { for(i=0; i< multi->connc->num; i++) {

View File

@ -168,8 +168,10 @@ curl_share_cleanup(CURLSH *sh)
return CURLSHE_IN_USE; return CURLSHE_IN_USE;
} }
if(share->hostcache) if(share->hostcache) {
Curl_hash_destroy(share->hostcache); Curl_hash_destroy(share->hostcache);
share->hostcache = NULL;
}
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES) #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
if(share->cookies) if(share->cookies)

View File

@ -450,8 +450,11 @@ CURLcode Curl_close(struct SessionHandle *data)
return CURLE_OK; return CURLE_OK;
} }
if(data->dns.hostcachetype == HCACHE_PRIVATE) if(data->dns.hostcachetype == HCACHE_PRIVATE) {
Curl_hash_destroy(data->dns.hostcache); Curl_hash_destroy(data->dns.hostcache);
data->dns.hostcachetype = HCACHE_NONE;
data->dns.hostcache = NULL;
}
if(data->state.rangestringalloc) if(data->state.rangestringalloc)
free(data->state.range); free(data->state.range);