easy: add check to malloc() when running event-based

... to allow torture tests then too.
This commit is contained in:
Daniel Stenberg 2016-03-14 15:37:03 +01:00
parent 6a353b105a
commit b51f04bf23
1 changed files with 13 additions and 9 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -541,14 +541,18 @@ static int events_socket(CURL *easy, /* easy handle */
} }
else { else {
m = malloc(sizeof(struct socketmonitor)); m = malloc(sizeof(struct socketmonitor));
m->next = ev->list; if(m) {
m->socket.fd = s; m->next = ev->list;
m->socket.events = socketcb2poll(what); m->socket.fd = s;
m->socket.revents = 0; m->socket.events = socketcb2poll(what);
ev->list = m; m->socket.revents = 0;
infof(easy, "socket cb: socket %d ADDED as %s%s\n", s, ev->list = m;
what&CURL_POLL_IN?"IN":"", infof(easy, "socket cb: socket %d ADDED as %s%s\n", s,
what&CURL_POLL_OUT?"OUT":""); what&CURL_POLL_IN?"IN":"",
what&CURL_POLL_OUT?"OUT":"");
}
else
return CURLE_OUT_OF_MEMORY;
} }
} }