summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-09-09 01:01:04 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-09 01:04:10 -0700
commit8e4650a662d0fddd1a67dff765bdf20046b70abe (patch)
tree5b122256435c9a34e2919e12dc8352a6ac8db023
parent9b226cc588eafd4932f2ade1c4e9280f4eca39bf (diff)
mgmt/glusterd: op mem leak fixes
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1186 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1186
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c13
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h2
2 files changed, 5 insertions, 10 deletions
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();