summaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-08-06 23:42:50 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-08-06 23:42:50 +0200
commitfa48987356e3c1ced8ac32f10b06e578a4d23583 (patch)
tree66d308ee3612a731ed346f0b36e6b33c708834ad /lib/easy.c
parentd6c8def82a2cfc0d177acc81e4244221d4e98f2f (diff)
downloadcurl-fa48987356e3c1ced8ac32f10b06e578a4d23583.tar.gz
easy_events: make event data static
First: this function is only used in debug-builds and not in release/real builds. It is used to drive tests using the event-based API. A pointer to the local struct is passed to CURLMOPT_TIMERDATA, but the CURLMOPT_TIMERFUNCTION calback can in fact be called even after this funtion returns, namely when curl_multi_remove_handle() is called. Reported-by: Brian Carpenter
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/easy.c b/lib/easy.c
index 33ae90fd5..66ec38a5e 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -653,7 +653,9 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
*/
static CURLcode easy_events(struct Curl_multi *multi)
{
- struct events evs= {2, FALSE, 0, NULL, 0};
+ /* this struct is made static to allow it to be used after this function
+ returns and curl_multi_remove_handle() is called */
+ static struct events evs= {2, FALSE, 0, NULL, 0};
/* if running event-based, do some further multi inits */
events_setup(multi, &evs);