summaryrefslogtreecommitdiffstats
path: root/source3/smbd/notify_inotify.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-27 13:07:03 +0000
committerJeremy Allison <jra@samba.org>2014-12-09 04:12:08 +0100
commit608774d8c4a14863d1e603d0b2f0dac94e8f69a7 (patch)
tree38670cfcfe6d9aba22be74eecac6092589227b28 /source3/smbd/notify_inotify.c
parent18b682250457e60ae75d4352c7f0b88686eb1dd8 (diff)
downloadsamba-608774d8c4a14863d1e603d0b2f0dac94e8f69a7.tar.gz
samba-608774d8c4a14863d1e603d0b2f0dac94e8f69a7.tar.xz
samba-608774d8c4a14863d1e603d0b2f0dac94e8f69a7.zip
notify_inotify: Add a NULL check
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/notify_inotify.c')
-rw-r--r--source3/smbd/notify_inotify.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
index 2425bb4a5b..56f4941066 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;
}