summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/timer.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-28 03:31:10 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-28 03:34:54 -0700
commit927aedbb556ee07250248181f52642eeb6de9e58 (patch)
tree034a196708a1c1260951cafeefc42b427bee8479 /libglusterfs/src/timer.c
parent753146c0ff4b1b55892b71b36d6ca97797867aaa (diff)
removed last few remaining 'ERR_ABORT's from codebase
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 966 (NULL check for avoiding NULL dereferencing of pointers..) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=966
Diffstat (limited to 'libglusterfs/src/timer.c')
-rw-r--r--libglusterfs/src/timer.c15
1 files changed, 9 insertions, 6 deletions
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 (&reg->lock, NULL);
reg->active.next = &reg->active;
reg->active.prev = &reg->active;
@@ -220,6 +221,8 @@ gf_timer_registry_init (glusterfs_ctx_t *ctx)
reg->stale.prev = &reg->stale;
pthread_create (&reg->th, NULL, gf_timer_proc, ctx);
+ ctx->timer = reg;
}
+out:
return ctx->timer;
}