Pārlūkot izejas kodu

http_async_client: fixed crash on curl callback

Nikolay Ivanuschak 10 mēneši atpakaļ
vecāks
revīzija
909e659dc3
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. 3 1
      src/modules/http_async_client/http_multi.c

+ 3 - 1
src/modules/http_async_client/http_multi.c

@@ -157,10 +157,12 @@ void event_cb(int fd, short kind, void *userp)
 /* CURLMOPT_SOCKETFUNCTION */
 int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
 {
+	struct http_m_cell *cell;
 	struct http_m_global *g = (struct http_m_global *)cbp;
-	struct http_m_cell *cell = (struct http_m_cell *)sockp;
 	const char *whatstr[] = {"none", "IN", "OUT", "INOUT", "REMOVE"};
 
+	cell = http_m_cell_lookup(e);
+
 	LM_DBG("socket callback: s=%d e=%p what=%s\n", s, e, whatstr[what]);
 	if(what == CURL_POLL_REMOVE) {
 		/* if cell is NULL the handle has been removed by the event callback for timeout */