From: Yang Tse Date: Sun, 23 Dec 2012 20:10:45 +0000 (+0100) Subject: curl_multi_wait: OOM handling fix X-Git-Tag: curl-7_29_0~194 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a099071465a9c2d203a2d4e758ede7c7f04e615;p=curl curl_multi_wait: OOM handling fix --- 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 */