From 927aedbb556ee07250248181f52642eeb6de9e58 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 28 Jul 2010 03:31:10 +0000 Subject: removed last few remaining 'ERR_ABORT's from codebase Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966 --- libglusterfs/src/timer.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'libglusterfs/src/timer.c') diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c index 7ff18f94e35..3e39231e0b7 100644 --- a/libglusterfs/src/timer.c +++ b/libglusterfs/src/timer.c @@ -201,18 +201,19 @@ gf_timer_proc (void *ctx) gf_timer_registry_t * gf_timer_registry_init (glusterfs_ctx_t *ctx) { - if (ctx == NULL) - { + if (ctx == NULL) { gf_log ("timer", GF_LOG_ERROR, "invalid argument"); return NULL; } - + if (!ctx->timer) { gf_timer_registry_t *reg = NULL; - ctx->timer = reg = GF_CALLOC (1, sizeof (*reg), - gf_common_mt_gf_timer_registry_t); - ERR_ABORT (reg); + reg = GF_CALLOC (1, sizeof (*reg), + gf_common_mt_gf_timer_registry_t); + if (!reg) + goto out; + pthread_mutex_init (®->lock, NULL); reg->active.next = ®->active; reg->active.prev = ®->active; @@ -220,6 +221,8 @@ gf_timer_registry_init (glusterfs_ctx_t *ctx) reg->stale.prev = ®->stale; pthread_create (®->th, NULL, gf_timer_proc, ctx); + ctx->timer = reg; } +out: return ctx->timer; } -- cgit