summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2011-04-15 14:02:39 +0000
committerVijay Bellur <vijay@gluster.com>2011-04-15 12:56:34 -0700
commitda66edbe927152ba12c9a702fd157a45a3f3cb42 (patch)
tree286e8b3f85783e2d5473b07a8da2ce89e24a2ce5 /xlators
parentcfe11cd627f8322ad2701dad6c021d3570bbbf1d (diff)
mgmt/glusterd: fix double free.v3.2.0qa13
- the limit-usage string should be stored as static, since remove-limits will be modifying it and probably freeing it. - this static string should also be explicitly freed in glusterd_quota_disable since dict_del won't free it. Signed-off-by: Raghavendra G <raghavendra@gluster.com> Signed-off-by: Vijay Bellur <vijay@gluster.com> BUG: 2776 (gluster quota remove crashed glusterd) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2776
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index 8f4b63096a0..fae19e2265e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -5208,7 +5208,7 @@ int32_t
glusterd_quota_disable (glusterd_volinfo_t *volinfo, char **op_errstr)
{
int32_t ret = -1;
- char *quota_status = NULL;
+ char *quota_status = NULL, *quota_limits = NULL;
GF_VALIDATE_OR_GOTO ("glusterd", volinfo, out);
GF_VALIDATE_OR_GOTO ("glusterd", op_errstr, out);
@@ -5235,6 +5235,14 @@ glusterd_quota_disable (glusterd_volinfo_t *volinfo, char **op_errstr)
*op_errstr = gf_strdup ("Disabling quota has been successful");
+ ret = glusterd_volinfo_get (volinfo, VKEY_FEATURES_LIMIT_USAGE,
+ &quota_limits);
+ if (ret) {
+ gf_log ("", GF_LOG_WARNING, "failed to get the quota limits");
+ } else {
+ GF_FREE (quota_limits);
+ }
+
dict_del (volinfo->dict, VKEY_FEATURES_LIMIT_USAGE);
out:
@@ -5314,8 +5322,8 @@ glusterd_quota_limit_usage (glusterd_volinfo_t *volinfo, dict_t *dict, char **op
quota_limits = value;
- ret = dict_set_dynstr (volinfo->dict, VKEY_FEATURES_LIMIT_USAGE,
- quota_limits);
+ ret = dict_set_str (volinfo->dict, VKEY_FEATURES_LIMIT_USAGE,
+ quota_limits);
if (ret) {
gf_log ("", GF_LOG_ERROR, "Unable to set quota limits" );
*op_errstr = gf_strdup ("failed to set limit");