summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-02-16 20:10:24 +0530
committerVijay Bellur <vbellur@redhat.com>2013-03-03 06:19:26 -0800
commite776deed24645cc52b0fab46d566c91b4163adc1 (patch)
treedc7b4067639daa93faba74ea8bb2bd0dde0d692f /libglusterfs
parent9a847dac1e73a4994e50273c056e276719b863c9 (diff)
libglusterfs: Fix memory leaks in fd_lk_insert_and_merge
Change-Id: I666664895fdd7c7199797796819e652557a7ac99 BUG: 834465 Signed-off-by: Vijay Bellur <vbellur@redhat.com> Reviewed-on: http://review.gluster.org/4529 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'libglusterfs')
-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 fff4aa9966c..caf2bb38e51 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);
}
}