diff options
author | Pranith Kumar K <pranithk@gluster.com> | 2010-08-26 11:42:24 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-08-27 01:50:42 -0700 |
commit | 7fc38ce7783891218a0cb83d233d579e64831e33 (patch) | |
tree | 5a9c5eb7557ea335142e08e09ea9b4c5e16ccb0c /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 67d8b620186807f38277713930da2a1d1926d6d0 (diff) |
mgmt/glusterd: free op ctx only if it is allocated
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1236 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1236
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 64b4a18c0de..ecbe7b150ff 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -51,7 +51,7 @@ #include <signal.h> static struct list_head gd_op_sm_queue; -glusterd_op_info_t opinfo; +glusterd_op_info_t opinfo = {{0},}; static int glusterfs_port = GLUSTERD_DEFAULT_PORT; static void @@ -2470,6 +2470,7 @@ glusterd_op_txn_complete () glusterd_op_clear_commit_op (op); glusterd_op_clear_op (op); glusterd_op_clear_ctx (op); + glusterd_op_clear_ctx_free (op); } out: @@ -3033,7 +3034,9 @@ glusterd_op_clear_ctx (glusterd_op_t op) opinfo.op_ctx[op] = NULL; - //Cleanup to be done here + if (ctx && glusterd_op_get_ctx_free(op)) { + GF_FREE(ctx); + } return 0; } @@ -3048,6 +3051,42 @@ glusterd_op_get_ctx (glusterd_op_t op) } +int32_t +glusterd_op_set_ctx_free (glusterd_op_t op, gf_boolean_t ctx_free) +{ + + GF_ASSERT (op < GD_OP_MAX); + GF_ASSERT (op > GD_OP_NONE); + + opinfo.ctx_free[op] = ctx_free; + + return 0; + +} + +int32_t +glusterd_op_clear_ctx_free (glusterd_op_t op) +{ + + GF_ASSERT (op < GD_OP_MAX); + GF_ASSERT (op > GD_OP_NONE); + + opinfo.ctx_free[op] = _gf_false; + + return 0; + +} + +gf_boolean_t +glusterd_op_get_ctx_free (glusterd_op_t op) +{ + GF_ASSERT (op < GD_OP_MAX); + GF_ASSERT (op > GD_OP_NONE); + + return opinfo.ctx_free[op]; + +} + int glusterd_op_sm_init () { |