summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-locks.c
diff options
context:
space:
mode:
authorGaurav Yadav <gyadav@redhat.com>2018-03-01 14:44:34 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-03-06 08:05:24 +0000
commit4511b45bf4d13581cd74c4b87495eda6d54ec5be (patch)
tree1ca1f532e01a856be805cf128021916c2180ef87 /xlators/mgmt/glusterd/src/glusterd-locks.c
parent9be043159a514db68b336c6aea49613f3125c5e0 (diff)
glusterd : memory leak in mgmt_v3 lock functionality
In order to take care of stale lock issue, a timer was intrduced in mgmt_v3 lock. This timer is not freeing the memory due to which this leak got introduced With this fix now memory cleanup in locking is handled properly Change-Id: I2e1ce3ebba3520f7660321f3d97554080e4e22f4 BUG: 1550339 Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-locks.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c
index 4e199e186ef..708ebffd2da 100644
--- a/xlators/mgmt/glusterd/src/glusterd-locks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-locks.c
@@ -719,6 +719,7 @@ gd_mgmt_v3_unlock_timer_cbk (void *data)
int32_t ret = -1;
glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
xlator_t *mgmt_lock_timer_xl = NULL;
+ gf_timer_t *timer = NULL;
this = THIS;
GF_VALIDATE_OR_GOTO ("glusterd", this, out);
@@ -765,6 +766,8 @@ out:
GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx,
ret_function);
+ timer = mgmt_lock_timer->timer;
+ GF_FREE (timer->data);
gf_timer_call_cancel (mgmt_lock_timer_ctx,
mgmt_lock_timer->timer);
GF_FREE(key);
@@ -791,6 +794,7 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
xlator_t *this = NULL;
glusterfs_ctx_t *mgmt_lock_timer_ctx = NULL;
xlator_t *mgmt_lock_timer_xl = NULL;
+ gf_timer_t *timer = NULL;
this = THIS;
GF_ASSERT (this);
@@ -893,6 +897,9 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type)
mgmt_lock_timer_ctx = mgmt_lock_timer_xl->ctx;
GF_VALIDATE_OR_GOTO (this->name, mgmt_lock_timer_ctx, out);
ret = 0;
+
+ timer = mgmt_lock_timer->timer;
+ GF_FREE (timer->data);
gf_timer_call_cancel (mgmt_lock_timer_ctx,
mgmt_lock_timer->timer);
dict_del (priv->mgmt_v3_lock_timer, key_dup);