From 79db93438a49adc1fb558d8fe7646177a7011a23 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 22 Jul 2009 12:37:34 -0400 Subject: [PATCH] Minor cleanups in monitor.c 1) Forgot to check for successful allocation 2) Used the wrong mem_ctx when allocating a timer event. --- server/monitor/monitor.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c index 269fcbf..4e92213 100644 --- a/server/monitor/monitor.c +++ b/server/monitor/monitor.c @@ -1308,6 +1308,10 @@ static void process_config_file(struct tevent_context *ev, * so that read ptr is in the right place */ name = talloc_size(tmp_ctx, len); + if (!name) { + talloc_free(tmp_ctx); + return; + } total_len = 0; while (total_len < in_event->len) { len = read(file_ctx->mt_ctx->inotify_fd, &name, in_event->len); @@ -1355,7 +1359,7 @@ static void process_config_file(struct tevent_context *ev, rw_ctx->cb = cb; rw_ctx->file_ctx = file_ctx; - tev = tevent_add_timer(ev, ev, tv, rewatch_config_file, rw_ctx); + tev = tevent_add_timer(ev, rw_ctx, tv, rewatch_config_file, rw_ctx); if (te == NULL) { DEBUG(0, ("Could not restore inotify watch. Quitting!\n")); close(file_ctx->mt_ctx->inotify_fd); -- 1.6.2.5