From 7a099071465a9c2d203a2d4e758ede7c7f04e615 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 23 Dec 2012 21:10:45 +0100 Subject: [PATCH] curl_multi_wait: OOM handling fix --- lib/multi.c | 7 +++++-- 1 file 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 */