summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-op-sm.c
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2018-08-21 23:33:58 -0700
committerAmar Tumballi <amarts@redhat.com>2018-08-23 03:44:18 +0000
commit101723cc466a069e5e19b31378305255522f7e84 (patch)
treeea83bbe638d74fde4c9c8b3fa122a16c6a7780ce /xlators/mgmt/glusterd/src/glusterd-op-sm.c
parent8096542c1cd3250593a0aa4c2dd32aa409f21723 (diff)
mgmt/glusterd: Fix memory leaks in glusterd-op-sm.c
Addresses the following CIDs: - 1124704: Removed an unessential variable that caused a memory leak in glusterd_op_set_volume(). Nuked an unnecessary log message upon error as well since failure logging is being done in the caller - 1124772: Memory leak in an error path of glusterd_op_ac_send_brick_op() - 1175021: Removed an unessential variable that caused a memory leak in glusterd_op_build_payload() Also addressed a memory leak in an error path of glusterd_dict_set_volid() Change-Id: I060effbbcebe9d58b91f606175080ede517ba239 updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 9d578349807..c013f64c2fe 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -2904,7 +2904,6 @@ glusterd_op_set_volume (dict_t *dict, char **errstr)
char *key_fixed = NULL;
char *value = NULL;
char str[50] = {0, };
- char *op_errstr = NULL;
gf_boolean_t global_opt = _gf_false;
gf_boolean_t global_opts_set = _gf_false;
glusterd_volinfo_t *voliter = NULL;
@@ -2929,15 +2928,7 @@ glusterd_op_set_volume (dict_t *dict, char **errstr)
}
if (dict_count == 0) {
- ret = glusterd_volset_help (NULL, &op_errstr);
- if (ret) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- GD_MSG_VOL_SET_FAIL, "%s",
- (op_errstr)? op_errstr:
- "Volume set help internal error");
- }
-
- GF_FREE(op_errstr);
+ ret = glusterd_volset_help (NULL, errstr);
goto out;
}
@@ -2950,7 +2941,7 @@ glusterd_op_set_volume (dict_t *dict, char **errstr)
if (strcasecmp (volname, "all") == 0) {
ret = glusterd_op_set_all_volume_options (this, dict,
- &op_errstr);
+ errstr);
goto out;
}
@@ -4421,6 +4412,7 @@ glusterd_dict_set_volid (dict_t *dict, char *volname, char **op_errstr)
if (ret) {
snprintf (msg, sizeof (msg), "Failed to set volume id of volume"
" %s", volname);
+ GF_FREE (volid);
goto out;
}
out:
@@ -4472,7 +4464,6 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
glusterd_op_t op = GD_OP_NONE;
char *volname = NULL;
uint32_t status_cmd = GF_CLI_STATUS_NONE;
- char *errstr = NULL;
xlator_t *this = NULL;
gf_boolean_t do_common = _gf_false;
@@ -4531,7 +4522,7 @@ glusterd_op_build_payload (dict_t **req, char **op_errstr, dict_t *op_ctx)
case GD_OP_GSYNC_SET:
{
ret = glusterd_op_gsync_args_get (dict,
- &errstr,
+ op_errstr,
&volname,
NULL, NULL);
if (ret == 0) {
@@ -7781,6 +7772,7 @@ glusterd_op_ac_send_brick_op (glusterd_op_sm_event_t *event, void *ctx)
gf_asprintf (&op_errstr,
OPERRSTR_BUILD_PAYLOAD);
opinfo.op_errstr = op_errstr;
+ GF_FREE (req_ctx);
goto out;
}
}