summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorLalatendu Mohanty <lmohanty@redhat.com>2014-01-21 02:27:03 +0530
committerAnand Avati <avati@redhat.com>2014-02-03 17:29:54 -0800
commit33e9e8fcb98cd8ddd483b37ff7114ea9fd8d75fb (patch)
treee309ad84233a02783009556954d3bf7762b7dd55 /xlators
parent120235d6f5c85af2a0be17ad2705159e9d0b3adf (diff)
quota: Fixing a possibility of GF_FREE on an array pointer
Issue: when the charecter pointer is not heap allocated by the program we should not do GF_FREE on it. Change-Id: Ibccc25491a9ab924fd5b82c14566f551a061ec2e BUG: 789278 Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com> Reviewed-on: http://review.gluster.org/6741 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/quota/src/quota.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 416d9ce652a..a8b4eb2c360 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -4027,6 +4027,7 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
char *path = NULL;
int64_t cur_size = 0;
quota_priv_t *priv = NULL;
+ gf_boolean_t dyn_mem = _gf_true;
priv = this->private;
if ((ctx->soft_lim <= 0) || (timerisset (&ctx->prev_log) &&
@@ -4041,6 +4042,7 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
if (!usage_str) {
snprintf (size_str, sizeof (size_str), "%"PRId64, cur_size);
usage_str = (char*) size_str;
+ dyn_mem = _gf_false;
}
inode_path (inode, NULL, &path);
if (!path)
@@ -4061,7 +4063,8 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
ctx->prev_log = cur_time;
}
- GF_FREE (usage_str);
+ if (dyn_mem)
+ GF_FREE (usage_str);
}
int32_t