summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-09-21 11:55:12 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-09-22 13:33:33 +0000
commit28bc9e4bf74fd31a9620478b0a0ed482798b5915 (patch)
tree757831eee842dc8225af2c529d8f4712c2977aff /xlators/mgmt
parent27402fcb27a7e9ea32a6a04fdc21b59af6320bb4 (diff)
glusterd: fix resource leak coverity issues
This patch addresses CID 1288098,1370948 and 1382454 key_fixed is allocated with memory but missed to free it. updates: bz#789278 Change-Id: Iea805c668ba89759313f9e21b328757e570be97b Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c2
3 files changed, 4 insertions, 8 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 12e7d30320e..74238e71ad7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -4988,6 +4988,7 @@ out:
&rsp.dict.dict_len);
glusterd_submit_reply(req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_cli_rsp);
+ GF_FREE(key_fixed);
return ret;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 2edaf6ff202..ca09d5afe20 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1684,16 +1684,11 @@ glusterd_op_stage_reset_volume(dict_t *dict, char **op_errstr)
goto out;
} else if (strcmp(key, "cluster.watermark-low") == 0) {
ret = glusterd_water_limit_check(volinfo, _gf_false, op_errstr);
- if (ret)
- return ret;
} else if (strcmp(key, "cluster.watermark-hi") == 0) {
ret = glusterd_water_limit_check(volinfo, _gf_true, op_errstr);
- if (ret) {
- if (key_fixed)
- GF_FREE(key_fixed);
- return ret;
- }
}
+ if (ret)
+ goto out;
if (!exists) {
ret = snprintf(msg, sizeof(msg), "Option %s does not exist", key);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 7d611b11781..736e66a679f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -13137,7 +13137,7 @@ out:
if (ret && need_free) {
GF_FREE(def_val);
}
-
+ GF_FREE(key_fixed);
gf_msg_debug(THIS->name, 0, "Returning %d", ret);
return ret;