diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-03-27 18:22:15 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-04-02 02:44:47 -0700 |
commit | b0bb1a2c979078efa3ab024e14119df6087c4320 (patch) | |
tree | 1ef163912d342ff1f595dfcc4e9791d22dde7a67 | |
parent | dc2a52fa0d83ba2e807a175655fc0362b707a22d (diff) |
cli: do the proper STACK_DESTORY of created frames
* fixes memory leaks
* fixes some random local mem-pool empty messages
Change-Id: Ic79f279f2acfe4722fa54d52397d0267b3918928
Signed-off-by: Amar Tumballi <amarts@redhat.com>
BUG: 803638
Reviewed-on: http://review.gluster.com/3018
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r-- | cli/src/cli-cmd-peer.c | 10 | ||||
-rw-r--r-- | cli/src/cli-cmd-volume.c | 71 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 18 |
3 files changed, 94 insertions, 5 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c index 7f0d28f6d..60756f310 100644 --- a/cli/src/cli-cmd-peer.c +++ b/cli/src/cli-cmd-peer.c @@ -96,6 +96,9 @@ out: if ((sent == 0) && (parse_error == 0)) cli_out ("Peer probe failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -161,6 +164,9 @@ out: cli_out ("Peer detach failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -196,6 +202,10 @@ out: if ((sent == 0) && (parse_error == 0)) cli_out ("Peer status failed"); } + + if (frame) + STACK_DESTROY (frame->root); + return ret; } diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 7ba4e838f..6b65d5f85 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -106,7 +106,7 @@ out: } frame->local = NULL; if (frame) - FRAME_DESTROY (frame); + STACK_DESTROY (frame->root); return ret; @@ -175,6 +175,9 @@ out: if (dict) dict_unref (dict); + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -401,6 +404,9 @@ out: cli_out ("Volume create failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -452,6 +458,9 @@ out: cli_out ("Volume delete failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -529,6 +538,9 @@ out: cli_out ("Volume start failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -648,6 +660,10 @@ out: } if (dict) dict_unref (dict); + + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -704,6 +720,9 @@ out: cli_out ("Volume rename on '%s' failed", (char *)words[2]); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -799,6 +818,9 @@ out: cli_out ("Volume rebalance failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -842,6 +864,9 @@ out: cli_out ("Volume reset failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -886,6 +911,9 @@ out: cli_out ("Volume profile failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -930,6 +958,9 @@ out: cli_out ("Volume set failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -992,6 +1023,9 @@ out: cli_out ("Volume add-brick failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1044,6 +1078,9 @@ out: if (ret && parse_err == 0) cli_out ("Quota command failed"); + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1102,6 +1139,10 @@ out: if (options) dict_unref (options); + + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1151,6 +1192,9 @@ out: cli_out ("Volume replace-brick failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1204,6 +1248,9 @@ out: cli_out ("Volume top failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1250,6 +1297,9 @@ out: cli_out ("Volume log rotate failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1352,6 +1402,9 @@ out: if (ret && parse_err == 0) cli_out (GEOREP" command failed"); + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1397,6 +1450,10 @@ cli_cmd_volume_status_cbk (struct cli_state *state, out: if (dict) dict_unref (dict); + + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1624,6 +1681,9 @@ out: if (options) dict_unref (options); + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1676,6 +1736,9 @@ out: cli_out ("Volume statedump failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1704,6 +1767,9 @@ out: cli_out ("Volume list failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } @@ -1758,6 +1824,9 @@ out: cli_out ("Volume clear-locks failed"); } + if (frame) + STACK_DESTROY (frame->root); + return ret; } diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 6deda9c00..70c9a3d80 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -947,8 +947,10 @@ gf_cli3_1_stop_volume_cbk (struct rpc_req *req, struct iovec *iov, frame = myframe; - if (frame) + if (frame) { local = frame->local; + frame->local = NULL; + } if (local) { dict = local->dict; @@ -988,6 +990,7 @@ out: free (rsp.dict.dict_val); if (local) cli_local_wipe (local); + return ret; } @@ -1027,8 +1030,10 @@ gf_cli3_1_defrag_volume_cbk (struct rpc_req *req, struct iovec *iov, frame = myframe; - if (frame) + if (frame) { local = frame->local; + frame->local = NULL; + } if (local) { local_dict = local->dict; @@ -1742,6 +1747,9 @@ gf_cli3_1_replace_brick_cbk (struct rpc_req *req, struct iovec *iov, ret = rsp.op_ret; out: + if (frame) + frame->local = NULL; + if (local) { dict_unref (local->dict); cli_local_wipe (local); @@ -2951,8 +2959,8 @@ gf_cli3_1_replace_brick (call_frame_t *frame, xlator_t *this, goto out; } - local->dict = dict_ref (dict); - frame->local = local; + local->dict = dict_ref (dict); + frame->local = local; ret = dict_get_int32 (dict, "operation", &op); if (ret) { @@ -5496,6 +5504,8 @@ gf_cli_status_volume_all (call_frame_t *frame, xlator_t *this, void *data) gf_log ("cli", GF_LOG_ERROR, "status all failed"); if (ret && dict) dict_unref (dict); + if (frame) + frame->local = NULL; return ret; } |