aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/url.c b/lib/url.c
index aa15ec009..f9181fe60 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -233,6 +233,11 @@ CURLcode Curl_close(struct SessionHandle *data)
Curl_digest_cleanup(data);
+#ifdef USE_ARES
+ /* this destroys the channel and we cannot use it anymore after this */
+ ares_destroy(data->state.areschannel);
+#endif
+
/* No longer a dirty share, if it exists */
if (data->share)
data->share->dirty--;
@@ -253,6 +258,15 @@ CURLcode Curl_open(struct SessionHandle **curl)
memset(data, 0, sizeof(struct SessionHandle));
+#ifdef USE_ARES
+ if(ARES_SUCCESS != ares_init(&data->state.areschannel)) {
+ free(data);
+ return CURLE_FAILED_INIT;
+ }
+ /* make sure that all other returns from this function should destroy the
+ ares channel before returning error! */
+#endif
+
/* We do some initial setup here, all those fields that can't be just 0 */
data->state.headerbuff=(char*)malloc(HEADERSIZE);
@@ -319,7 +333,6 @@ CURLcode Curl_open(struct SessionHandle **curl)
data->set.ssl.CAfile = (char *)CURL_CA_BUNDLE;
#endif
-
memset(data->state.connects, 0,
sizeof(struct connectdata *)*data->state.numconnects);