diff --git a/os/ospoll.c b/os/ospoll.c index bca039a10..31dfd0527 100644 --- a/os/ospoll.c +++ b/os/ospoll.c @@ -207,6 +207,8 @@ ospoll_create(void) { #if POLLSET struct ospoll *ospoll = calloc(1, sizeof (struct ospoll)); + if (!ospoll) + return NULL; ospoll->ps = pollset_create(-1); if (ospoll->ps < 0) { @@ -217,6 +219,8 @@ ospoll_create(void) #endif #if PORT struct ospoll *ospoll = calloc(1, sizeof (struct ospoll)); + if (!ospoll) + return NULL; ospoll->epoll_fd = port_create(); if (ospoll->epoll_fd < 0) { @@ -228,6 +232,8 @@ ospoll_create(void) #endif #if EPOLL struct ospoll *ospoll = calloc(1, sizeof (struct ospoll)); + if (!ospoll) + return NULL; ospoll->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (ospoll->epoll_fd < 0) {