aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/multi.c7
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 */