summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-02-18 10:08:05 +0530
committerAnand Avati <avati@redhat.com>2013-02-17 20:49:42 -0800
commit23fad84fa8e68db05b8b0bb23fe2baa3dd494e08 (patch)
treea2ac335d8ee93e57ba125d3bfb84acb775b21ce7
parent988460a9f597a489f22d39cd259fdb17fe2e5de6 (diff)
libglusterfs: Fix memory leaks in fd_lk_insert_and_merge
Change-Id: Id322717b79c5252172811fea259f2073f710a463 BUG: 834465 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/4530 Reviewed-by: Anand Avati <avati@redhat.com> Tested-by: Anand Avati <avati@redhat.com>
-rw-r--r--libglusterfs/src/fd-lk.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libglusterfs/src/fd-lk.c b/libglusterfs/src/fd-lk.c
index 0c439fe..4185e1b 100644
--- a/libglusterfs/src/fd-lk.c
+++ b/libglusterfs/src/fd-lk.c
@@ -380,8 +380,8 @@ _fd_lk_insert_and_merge (fd_lk_ctx_t *lk_ctx,
return;
} else {
sum = _fd_lk_add_locks (entry, lock);
- sum->fl_type = entry->fl_type;
- sum->user_flock.l_type = entry->fl_type;
+ sum->fl_type = lock->fl_type;
+ sum->user_flock.l_type = lock->fl_type;
ret = _fd_lk_sub_locks (&v, sum, lock);
if (ret)
return;
@@ -391,6 +391,8 @@ _fd_lk_insert_and_merge (fd_lk_ctx_t *lk_ctx,
_fd_lk_delete_lock (lock);
_fd_lk_destroy_lock (lock);
+ _fd_lk_destroy_lock (sum);
+
for (i = 0; i < 3; i++) {
if (!v.locks[i])
continue;
@@ -407,7 +409,7 @@ _fd_lk_insert_and_merge (fd_lk_ctx_t *lk_ctx,
if (lock->fl_type != F_UNLCK) {
_fd_lk_insert_lock (lk_ctx, lock);
} else {
- _fd_lk_destroy_lock_list (lk_ctx);
+ _fd_lk_destroy_lock (lock);
}
}