summaryrefslogtreecommitdiff
path: root/lib/hash.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-10-07 20:50:57 +0200
committerYang Tse <yangsita@gmail.com>2011-10-07 20:50:57 +0200
commit17f48fe87979f159e2d8769d678641c60f4c0eed (patch)
tree322c1d34d9c8d0a4d203d127765818f297ac93c7 /lib/hash.c
parentb82bd05354cfa756a013d2bed4ffdc951ce903db (diff)
downloadcurl-17f48fe87979f159e2d8769d678641c60f4c0eed.tar.gz
libcurl: some OOM handling fixes
Diffstat (limited to 'lib/hash.c')
-rw-r--r--lib/hash.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 3a6e312a3..15b3efff6 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -72,9 +72,12 @@ Curl_hash_init(struct curl_hash *h,
for(i = 0; i < slots; ++i) {
h->table[i] = Curl_llist_alloc((curl_llist_dtor) hash_element_dtor);
if(!h->table[i]) {
- while(i--)
+ while(i--) {
Curl_llist_destroy(h->table[i], NULL);
+ h->table[i] = NULL;
+ }
free(h->table);
+ h->table = NULL;
return 1; /* failure */
}
}
@@ -240,6 +243,7 @@ Curl_hash_clean(struct curl_hash *h)
}
free(h->table);
+ h->table = NULL;
}
void