From 8e4650a662d0fddd1a67dff765bdf20046b70abe Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 9 Sep 2010 01:01:04 +0000 Subject: mgmt/glusterd: op mem leak fixes Signed-off-by: Pranith Kumar K Signed-off-by: Vijay Bellur BUG: 1186 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1186 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 13 ++++--------- xlators/mgmt/glusterd/src/glusterd-op-sm.h | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index e710f1179ab..db3305c6437 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -3219,6 +3219,7 @@ glusterd_op_txn_complete () glusterd_op_clear_op (op); ctx = glusterd_op_get_ctx (op); ctx_free = glusterd_op_get_ctx_free (op); + glusterd_op_set_ctx (op, NULL); glusterd_op_clear_ctx_free (op); } @@ -3227,7 +3228,7 @@ out: ret = glusterd_op_send_cli_response (cli_op, op_ret, op_errno, req, ctx); if (ctx_free && ctx && (op != -1)) - glusterd_op_clear_ctx (op); + glusterd_op_free_ctx (op, ctx, ctx_free); gf_log ("glusterd", GF_LOG_NORMAL, "Returning %d", ret); return ret; } @@ -3824,19 +3825,13 @@ glusterd_op_set_ctx (glusterd_op_t op, void *ctx) } int32_t -glusterd_op_clear_ctx (glusterd_op_t op) +glusterd_op_free_ctx (glusterd_op_t op, void *ctx, gf_boolean_t ctx_free) { - void *ctx = NULL; - GF_ASSERT (op < GD_OP_MAX); GF_ASSERT (op > GD_OP_NONE); - ctx = opinfo.op_ctx[op]; - - opinfo.op_ctx[op] = NULL; - - if (ctx && glusterd_op_get_ctx_free(op)) { + if (ctx && ctx_free) { switch (op) { case GD_OP_CREATE_VOLUME: case GD_OP_STOP_VOLUME: diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h index b6d052d4100..930224a9249 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h @@ -222,7 +222,7 @@ int32_t glusterd_op_clear_op (glusterd_op_t op); int32_t -glusterd_op_clear_ctx (glusterd_op_t op); +glusterd_op_free_ctx (glusterd_op_t op, void *ctx, gf_boolean_t ctx_free); int32_t glusterd_opinfo_unlock(); -- cgit