diff options
author | Yang Tse <yangsita@gmail.com> | 2012-12-23 21:10:45 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-12-23 21:50:39 +0100 |
commit | 7a099071465a9c2d203a2d4e758ede7c7f04e615 (patch) | |
tree | e78c5f62ee5cb69cd550aef29502cd274ade5cff /lib | |
parent | a1fc9b80c842e74243b6a0e52f2c64e4a96210ce (diff) |
curl_multi_wait: OOM handling fix
Diffstat (limited to 'lib')
-rw-r--r-- | lib/multi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/multi.c b/lib/multi.c index b3a52d2fe..52eeb7f9f 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -929,8 +929,11 @@ CURLMcode curl_multi_wait(CURLM *multi_handle, easy = easy->next; /* check next handle */ } - if(nfds) - ufds = (struct pollfd *)malloc(nfds * sizeof(struct pollfd)); + if(nfds) { + ufds = malloc(nfds * sizeof(struct pollfd)); + if(!ufds) + return CURLM_OUT_OF_MEMORY; + } nfds = 0; /* Add the curl handles to our pollfds first */ |