summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2016-05-23 14:31:51 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-06-01 06:28:48 -0700
commita04eaf366779a0632e5b9cdd6d63de0eb62f7449 (patch)
tree5a5345b9c4ec3b5037f7a3ac1aae93093aa2392d /xlators/features/locks
parent46c0b791d528bebf1168972a34f7483bfe683ba3 (diff)
__inode_ctx_put: fix mem leak on failure
up on failure case __inode_ctx_put need to free the allocated memory Indirect leak of 104 byte(s) in 1 object(s) allocated from: #0 0x496669 in __interceptor_calloc (/usr/local/sbin/glusterfsd+0x496669) #1 0x7f8a288522f9 in __gf_calloc libglusterfs/src/mem-pool.c:117 #2 0x7f8a17235962 in __posix_acl_ctx_get xlators/system/posix-acl/src/posix-acl.c:308 Change-Id: I0ce6da3967c55931a70f77d8551ccf52e4cdfda3 BUG: 1338733 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/14505 Tested-by: Prasanna Kumar Kalever <pkalever@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/features/locks')
-rw-r--r--xlators/features/locks/src/common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index facb078612f..4a9b138cb80 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -434,7 +434,12 @@ pl_inode_get (xlator_t *this, inode_t *inode)
INIT_LIST_HEAD (&pl_inode->blocked_calls);
gf_uuid_copy (pl_inode->gfid, inode->gfid);
- __inode_ctx_put (inode, this, (uint64_t)(long)(pl_inode));
+ ret = __inode_ctx_put (inode, this, (uint64_t)(long)(pl_inode));
+ if (ret) {
+ GF_FREE (pl_inode);
+ pl_inode = NULL;
+ goto unlock;
+ }
}
unlock:
UNLOCK (&inode->lock);