]> granicus.if.org Git - curl/commitdiff
attempt to fix or allow further detection of an elusive icc SIGSEGV
authorYang Tse <yangsita@gmail.com>
Sun, 19 Oct 2008 20:17:16 +0000 (20:17 +0000)
committerYang Tse <yangsita@gmail.com>
Sun, 19 Oct 2008 20:17:16 +0000 (20:17 +0000)
lib/easy.c
lib/hash.c
lib/hostip.c
lib/llist.c
lib/multi.c
lib/share.c
lib/url.c

index 04a219cbbae2ea56eb0b425759918270b23809f4..2c2490142908ffc69764d65ac959c47a0c063f7e 100644 (file)
@@ -502,9 +502,12 @@ CURLcode curl_easy_perform(CURL *curl)
       /* global dns cache was requested but still isn't */
       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 */
         Curl_hash_destroy(data->dns.hostcache);
+        data->dns.hostcachetype = HCACHE_NONE;
+        data->dns.hostcache = NULL;
+      }
 
       ptr = Curl_global_host_cache_init();
       if(ptr) {
index 095fa7028945feca3da5548ea74fd42f558efa40..39c7a079df808e8d327332508a96efb9be18a8ff 100644 (file)
@@ -44,6 +44,7 @@ hash_element_dtor(void *user, void *element)
 
   h->dtor(e->ptr);
 
+  memset(e, 0, sizeof(struct curl_hash_element));
   free(e);
 }
 
@@ -232,6 +233,7 @@ Curl_hash_clean(struct curl_hash *h)
 
   for (i = 0; i < h->slots; ++i) {
     Curl_llist_destroy(h->table[i], (void *) h);
+    h->table[i] = NULL;
   }
 
   free(h->table);
@@ -269,6 +271,8 @@ Curl_hash_destroy(struct curl_hash *h)
     return;
 
   Curl_hash_clean(h);
+
+  memset(h, 0, sizeof(struct struct curl_hash));
   free(h);
 }
 
index 05b40e323869bc5e898afda1dd4d40ade7635b3d..3a5f642fb9887f03c6af382e55d649947f7b3670 100644 (file)
@@ -695,6 +695,7 @@ static void freednsentry(void *freethis)
 
   Curl_freeaddrinfo(p->addr);
 
+  memset(p, 0, sizeof(struct Curl_dns_entry));
   free(p);
 }
 
index cd9edad63c81525d22870831df1f6adc09c6c990..0d08321c670bdcdbc6f7638526a3a654cfa72225 100644 (file)
@@ -113,6 +113,8 @@ Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
   }
 
   list->dtor(user, e->ptr);
+
+  memset(e, 0, sizeof(struct curl_llist_element));
   free(e);
   --list->size;
 
@@ -126,6 +128,7 @@ Curl_llist_destroy(struct curl_llist *list, void *user)
     while(list->size > 0)
       Curl_llist_remove(list, list->tail, user);
 
+    memset(list, 0, sizeof(struct curl_llist));
     free(list);
   }
 }
index 63db12a2193c00623ab4de776fac8541e8c344cc..e503a11a2cb00e67197283e29e129c3efc27cb76 100644 (file)
@@ -1551,6 +1551,8 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
     multi->type = 0; /* not good anymore */
     Curl_hash_destroy(multi->hostcache);
     Curl_hash_destroy(multi->sockhash);
+    multi->hostcache = NULL;
+    multi->sockhash = NULL;
 
     /* go over all connections that have close actions */
     for(i=0; i< multi->connc->num; i++) {
index 6430611b35bc8c6d53031936e1253e21b981f4f3..838a159164c905250bdd7b5a7f84fcafb442d3fd 100644 (file)
@@ -168,8 +168,10 @@ curl_share_cleanup(CURLSH *sh)
     return CURLSHE_IN_USE;
   }
 
-  if(share->hostcache)
+  if(share->hostcache) {
     Curl_hash_destroy(share->hostcache);
+    share->hostcache = NULL;
+  }
 
 #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
   if(share->cookies)
index 040a64cd1495a1097bb434d8ae2df8f4529d477b..a21cda0aeceee186b4711f5510f616586964d5df 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -450,8 +450,11 @@ CURLcode Curl_close(struct SessionHandle *data)
     return CURLE_OK;
   }
 
-  if(data->dns.hostcachetype == HCACHE_PRIVATE)
+  if(data->dns.hostcachetype == HCACHE_PRIVATE) {
     Curl_hash_destroy(data->dns.hostcache);
+    data->dns.hostcachetype = HCACHE_NONE;
+    data->dns.hostcache = NULL;
+  }
 
   if(data->state.rangestringalloc)
     free(data->state.range);