From 608774d8c4a14863d1e603d0b2f0dac94e8f69a7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 27 Oct 2014 13:07:03 +0000 Subject: [PATCH] notify_inotify: Add a NULL check Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/smbd/notify_inotify.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index 2425bb4a5bc..56f49410661 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -253,6 +253,7 @@ static void inotify_handler(struct tevent_context *ev, struct tevent_fd *fde, static NTSTATUS inotify_setup(struct sys_notify_context *ctx) { struct inotify_private *in; + struct tevent_fd *fde; in = talloc(ctx, struct inotify_private); NT_STATUS_HAVE_NO_MEMORY(in); @@ -269,7 +270,13 @@ static NTSTATUS inotify_setup(struct sys_notify_context *ctx) talloc_set_destructor(in, inotify_destructor); /* add a event waiting for the inotify fd to be readable */ - tevent_add_fd(ctx->ev, in, in->fd, TEVENT_FD_READ, inotify_handler, in); + fde = tevent_add_fd(ctx->ev, in, in->fd, TEVENT_FD_READ, + inotify_handler, in); + if (fde == NULL) { + ctx->private_data = NULL; + TALLOC_FREE(in); + return NT_STATUS_NO_MEMORY; + } return NT_STATUS_OK; } -- 2.11.4.GIT