mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user