diff options
author | Kaushik BV <kaushikbv@gluster.com> | 2010-09-06 01:36:57 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-09-15 05:09:19 -0700 |
commit | 703dbf354d53fdcc37851bb71420730675a7e170 (patch) | |
tree | b7ead4d4aa4513efc989735a8d25864fa183e684 | |
parent | 28d02d0b216ab2c580b1d3a48a793a312e1a98ae (diff) |
Leak in Locks
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 996 (leak in locks)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=996
-rw-r--r-- | xlators/features/locks/src/entrylk.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c index 6a0f81ec3..1e941e600 100644 --- a/xlators/features/locks/src/entrylk.c +++ b/xlators/features/locks/src/entrylk.c @@ -341,8 +341,13 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type, conf = __lock_grantable (dom, basename, type); if (conf) { ret = -EAGAIN; - if (nonblock) - goto out; + if (nonblock){ + if (lock->basename) + GF_FREE ((char *)lock->basename); + GF_FREE (lock); + goto out; + + } list_add_tail (&lock->blocked_locks, &dom->blocked_entrylks); @@ -355,8 +360,13 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type, if ( __blocked_lock_conflict (dom, basename, type) && !(__owner_has_lock (dom, lock))) { ret = -EAGAIN; - if (nonblock) + if (nonblock) { + if (lock->basename) + GF_FREE ((char *) lock->basename); + GF_FREE (lock); goto out; + + } lock->frame = frame; lock->this = this; |