summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorIra Cooper <ira@samba.org>2014-02-11 07:05:29 -0500
committerAnand Avati <avati@redhat.com>2014-02-14 21:05:12 -0800
commit5fb60ca150efbf9072dd7b2de13362c8cc4daa1b (patch)
tree8e2f487b086ca470a354477baa5072645941dbcf /xlators/mgmt/glusterd/src
parent5f0a857c70863eb685ac03d4183502d3bd460b7c (diff)
glusterd: Free dup_value when error path is taken.
When the error path is taken here, the data that was allocated for dup_value is never freed. This patch frees it. Thanks to Kaleb Keithley <kkeithle@redhat.com> for his suggestions on how to fix this. Change-Id: Iad88b9ab035602d15961b46c4954d54d54e0d65e CID: 1124705 BUG: 789278 Signed-off-by: Ira Cooper <ira@samba.org> Reviewed-on: http://review.gluster.org/6780 Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 385f14e..e3ae369 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -1721,10 +1721,6 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict)
if (ret)
goto out;
- dup_value = gf_strdup (value);
- if (!dup_value)
- goto out;
-
ret = glusterd_store_options (this, dup_opt);
if (ret)
goto out;
@@ -1739,10 +1735,18 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict)
else
next_version = NULL;
+ dup_value = gf_strdup (value);
+ if (!dup_value)
+ goto out;
+
ret = dict_set_dynstr (conf->opts, key, dup_value);
if (ret)
goto out;
+ else
+ dup_value = NULL; /* Protect the allocation from GF_FREE */
+
out:
+ GF_FREE (dup_value);
GF_FREE (key_fixed);
if (dup_opt)
dict_unref (dup_opt);