aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-27 13:59:11 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-27 14:41:07 +0100
commit2d356ba1683d47ebbd08e9d6e4bb4acbb8729fee (patch)
tree2bfc17dfefdd387663ea9ee0dc20ab91ee7d148d
parentdc0a7161f868ae2f8094289f45278cc702eafbd9 (diff)
ares_query_completed_cb: don't touch invalid data
When this callback is called due to the destruction of the ares handle, the connection pointer passed in as an argument may no longer pointing to valid data and this function doesn't need to do anything with it anyway so we make sure it doesn't. Bug: http://curl.haxx.se/mail/lib-2011-01/0333.html Reported by: Vsevolod Novikov
-rw-r--r--lib/hostares.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/hostares.c b/lib/hostares.c
index 8b1dc06a7..a165cb91f 100644
--- a/lib/hostares.c
+++ b/lib/hostares.c
@@ -332,8 +332,17 @@ static void ares_query_completed_cb(void *arg, /* (struct connectdata *) */
(void)timeouts; /* ignored */
#endif
- if (status == CURL_ASYNC_SUCCESS) {
+ switch(status) {
+ case CURL_ASYNC_SUCCESS:
ai = Curl_he2ai(hostent, conn->async.port);
+ break;
+ case ARES_EDESTRUCTION:
+ /* this ares handle is getting destroyed, the 'arg' pointer may not be
+ valid! */
+ return;
+ default:
+ /* do nothing */
+ break;
}
(void)Curl_addrinfo_callback(arg, status, ai);