fix possible bus error on shutdown when using events
[m6w6/ext-http] / php_http_client_curl.c
index b688497380aa49e02470be989ec920c2f47ee21f..37f255b733d7ed3a2fd8c6cd8564dfa15c5c3e0e 100644 (file)
@@ -1736,6 +1736,9 @@ static void php_http_client_curl_dtor(php_http_client_t *h)
 
 #if PHP_HTTP_HAVE_EVENT
        if (curl->timeout) {
+               if (event_initialized(curl->timeout) && event_pending(curl->timeout, EV_TIMEOUT, NULL)) {
+                       event_del(curl->timeout);
+               }
                efree(curl->timeout);
                curl->timeout = NULL;
        }