From 070cdbc65735bc25d967aaaff81d8500d0566f97 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Thu, 6 Jan 2022 22:28:24 +0900 Subject: [PATCH] [ALL] fix the epoll(map) crash (#1311) --- lib/core/ogs-epoll.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/core/ogs-epoll.c b/lib/core/ogs-epoll.c index ae315a1c6..86cbb1dfc 100644 --- a/lib/core/ogs-epoll.c +++ b/lib/core/ogs-epoll.c @@ -240,8 +240,9 @@ static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout) fd = context->event_list[i].data.fd; ogs_assert(fd != INVALID_SOCKET); + map = ogs_hash_get(context->map_hash, &fd, sizeof(fd)); - ogs_assert(map); + if (!map) continue; if (map->read && map->write && map->read == map->write) { map->read->handler(when, map->read->fd, map->read->data); @@ -254,10 +255,10 @@ static int epoll_process(ogs_pollset_t *pollset, ogs_time_t timeout) * So, we need to check map instance */ map = ogs_hash_get(context->map_hash, &fd, sizeof(fd)); - if (map) { - if ((when & OGS_POLLOUT) && map->write) - map->write->handler(when, map->write->fd, map->write->data); - } + if (!map) continue; + + if ((when & OGS_POLLOUT) && map->write) + map->write->handler(when, map->write->fd, map->write->data); } }