[vlc-devel] [PATCH 3/3] poll: report ENOMEM when malloc fails

Steve Lhomme robux4 at videolabs.io
Thu Nov 26 17:57:02 CET 2015


similar to a few lines further
---
 compat/poll.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/compat/poll.c b/compat/poll.c
index 15e98a6..c2984cd 100644
--- a/compat/poll.c
+++ b/compat/poll.c
@@ -125,7 +125,10 @@ int poll(struct pollfd *fds, unsigned nfds, int timeout)
 
     WSAEVENT *evts = malloc(nfds * sizeof (WSAEVENT));
     if (evts == NULL)
+    {
+        errno = ENOMEM;
         return -1; /* ENOMEM */
+    }
 
     DWORD ret = WSA_WAIT_FAILED;
     for (unsigned i = 0; i < nfds; i++)
-- 
2.6.3



More information about the vlc-devel mailing list