os: ospoll_create(): protect from allocation failure
| ../os/ospoll.c: In function ‘ospoll_create’: | ../os/ospoll.c:229:22: warning: dereference of possibly-NULL ‘ospoll’ [CWE-690] [-Wanalyzer-possible-null-dereference] | 229 | ospoll->epoll_fd = epoll_create1(EPOLL_CLOEXEC); | | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
1e2842f3e5
commit
eb09c17a54
|
@ -224,8 +224,9 @@ ospoll_create(void)
|
|||
return ospoll;
|
||||
#endif
|
||||
#if EPOLL
|
||||
struct ospoll *ospoll = calloc(1, sizeof (struct ospoll));
|
||||
|
||||
struct ospoll *ospoll = calloc(1, sizeof (struct ospoll));
|
||||
if (ospoll == NULL)
|
||||
return NULL;
|
||||
ospoll->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
||||
if (ospoll->epoll_fd < 0) {
|
||||
free (ospoll);
|
||||
|
|
Loading…
Reference in New Issue