summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-03-05 13:39:46 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2019-03-12 20:51:03 +0000
commit0d0b54a9de6ed7e13495d1bbbfcf43d7ac13adc2 (patch)
treeb4ade50b3b9850f954daa933d74f6d5724fecf3c /xlators/mgmt
parent47ed784e3759df8b237436a86f0d27acbe5efa81 (diff)
glusterd: glusterd memory leak while running "gluster v profile" in a loop
Problem: glusterd has memory leak while running "gluster v profile" in a loop Solution: Resolve leak code path to avoid leak > Change-Id: Id608703ff6d0ad34ed8f921a5d25544e24cfadcd > fixes: bz#1685414 > (Cherry pick from commit 9374484917466dff4688d96ff7faa0de1c804a6c) > (Reviewed on link https://review.gluster.org/#/c/glusterfs/+/22301/) Change-Id: I1ca118265f97b188f94b3d5cff649ec36cb18ca0 fixes: bz#1685771 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c4
2 files changed, 6 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index 175677e8e9f..61ad66ee6ec 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -1330,8 +1330,9 @@ out:
if (rsp.op_errstr)
free(rsp.op_errstr);
- if (rsp.dict.dict_val)
- free(rsp.dict.dict_val);
+ if (rsp_dict)
+ dict_unref(rsp_dict);
+
GF_FREE(peerid);
/* req->rpc_status set to -1 means, STACK_DESTROY will be called from
* the caller function.
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 4bf11e065e3..45b221c2e58 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -1653,6 +1653,7 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
char **op_errstr)
{
glusterd_pending_node_t *pending_node = NULL;
+ glusterd_pending_node_t *tmp = NULL;
struct cds_list_head selected = {
0,
};
@@ -1690,7 +1691,7 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
rsp_dict = NULL;
brick_count = 0;
- cds_list_for_each_entry(pending_node, &selected, list)
+ cds_list_for_each_entry_safe(pending_node, tmp, &selected, list)
{
rpc = glusterd_pending_node_get_rpc(pending_node);
if (!rpc) {
@@ -1747,6 +1748,7 @@ gd_brick_op_phase(glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict,
brick_count++;
glusterd_pending_node_put_rpc(pending_node);
+ GF_FREE(pending_node);
}
pending_node = NULL;