diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-10-30 13:09:08 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-10-30 21:23:22 -0700 |
commit | de001e8659d78dd16ba8515228c70fd2986e56df (patch) | |
tree | 0a8f3d75ed1cb273cc4ec50ec5463b0574413b3f /cli/src/cli3_1-cops.c | |
parent | 961d5fb6025f4901d63be8cfc8062bd8e2093021 (diff) |
cli: Fix memory leaks
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1198 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1198
Diffstat (limited to 'cli/src/cli3_1-cops.c')
-rw-r--r-- | cli/src/cli3_1-cops.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index 7e885a010..b2adb0188 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -592,14 +592,15 @@ gf_cli3_1_create_volume_cbk (struct rpc_req *req, struct iovec *iov, goto out; } + local = ((call_frame_t *) (myframe))->local; + ((call_frame_t *) (myframe))->local = NULL; + ret = gf_xdr_to_cli_create_vol_rsp (*iov, &rsp); if (ret < 0) { gf_log ("", GF_LOG_ERROR, "error"); goto out; } - local = ((call_frame_t *) (myframe))->local; - dict = local->u.create_vol.dict; ret = dict_get_str (dict, "volname", &volname); @@ -614,6 +615,14 @@ gf_cli3_1_create_volume_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); + if (dict) + dict_unref (dict); + if (local) + cli_local_wipe (local); + if (rsp.volname) + free (rsp.volname); + if (rsp.op_errstr) + free (rsp.op_errstr); return ret; } @@ -639,6 +648,7 @@ gf_cli3_1_delete_volume_cbk (struct rpc_req *req, struct iovec *iov, frame = myframe; local = frame->local; + frame->local = NULL; if (local) volname = local->u.delete_vol.volname; @@ -652,6 +662,9 @@ gf_cli3_1_delete_volume_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); + cli_local_wipe (local); + if (rsp.volname) + free (rsp.volname); gf_log ("", GF_LOG_NORMAL, "Returning with %d", ret); return ret; } @@ -678,8 +691,10 @@ gf_cli3_1_start_volume_cbk (struct rpc_req *req, struct iovec *iov, frame = myframe; - if (frame) + if (frame) { local = frame->local; + frame->local = NULL; + } if (local) volname = local->u.start_vol.volname; @@ -695,6 +710,12 @@ gf_cli3_1_start_volume_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); + if (local) + cli_local_wipe (local); + if (rsp.volname) + free (rsp.volname); + if (rsp.op_errstr) + free (rsp.op_errstr); return ret; } @@ -737,6 +758,10 @@ gf_cli3_1_stop_volume_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); + if (rsp.op_errstr) + free (rsp.op_errstr); + if (rsp.volname) + free (rsp.volname); return ret; } @@ -989,6 +1014,10 @@ gf_cli3_1_add_brick_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); + if (rsp.volname) + free (rsp.volname); + if (rsp.op_errstr) + free (rsp.op_errstr); return ret; } @@ -1020,6 +1049,10 @@ gf_cli3_1_remove_brick_cbk (struct rpc_req *req, struct iovec *iov, out: cli_cmd_broadcast_response (ret); + if (rsp.volname) + free (rsp.volname); + if (rsp.op_errstr) + free (rsp.op_errstr); return ret; } @@ -1559,6 +1592,9 @@ gf_cli3_1_create_volume (call_frame_t *frame, xlator_t *this, out: gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); + if (dict) + dict_unref (dict); + if (req.bricks.bricks_val) { GF_FREE (req.bricks.bricks_val); } |