From: Timo Sirainen Date: Wed, 19 Jul 2017 20:09:13 +0000 (+0300) Subject: lib: io_loop_extract_notify_fd() - Don't crash if no notifys have been added X-Git-Tag: 2.2.32.rc1~63 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f21d653d0871bb3c2dd4740cc0f1c51a352a7e0e;p=thirdparty%2Fdovecot%2Fcore.git lib: io_loop_extract_notify_fd() - Don't crash if no notifys have been added --- diff --git a/src/lib/ioloop-notify-inotify.c b/src/lib/ioloop-notify-inotify.c index 08e09fab4e..c8478872c9 100644 --- a/src/lib/ioloop-notify-inotify.c +++ b/src/lib/ioloop-notify-inotify.c @@ -221,7 +221,7 @@ int io_loop_extract_notify_fd(struct ioloop *ioloop) struct io_notify *io; int fd, new_inotify_fd; - if (ctx->inotify_fd == -1) + if (ctx == NULL || ctx->inotify_fd == -1) return -1; new_inotify_fd = inotify_init(); diff --git a/src/lib/ioloop-notify-kqueue.c b/src/lib/ioloop-notify-kqueue.c index 2532689ce8..e7d8da5210 100644 --- a/src/lib/ioloop-notify-kqueue.c +++ b/src/lib/ioloop-notify-kqueue.c @@ -207,7 +207,7 @@ int io_loop_extract_notify_fd(struct ioloop *ioloop) struct io_notify *io; int fd, new_kq; - if (ctx->kq == -1) + if (ctx == NULL || ctx->kq == -1) return -1; new_kq = kqueue();