From a04eaf366779a0632e5b9cdd6d63de0eb62f7449 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Mon, 23 May 2016 14:31:51 +0530 Subject: __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 Reviewed-on: http://review.gluster.org/14505 Tested-by: Prasanna Kumar Kalever Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/performance/write-behind/src/write-behind.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xlators/performance/write-behind/src') diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index c47b537c4fc..98b448be332 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -592,6 +592,7 @@ __wb_inode_create (xlator_t *this, inode_t *inode) { wb_inode_t *wb_inode = NULL; wb_conf_t *conf = NULL; + int ret = 0; GF_VALIDATE_OR_GOTO (this->name, inode, out); @@ -613,7 +614,11 @@ __wb_inode_create (xlator_t *this, inode_t *inode) LOCK_INIT (&wb_inode->lock); - __inode_ctx_put (inode, this, (uint64_t)(unsigned long)wb_inode); + ret = __inode_ctx_put (inode, this, (uint64_t)(unsigned long)wb_inode); + if (ret) { + GF_FREE (wb_inode); + wb_inode = NULL; + } out: return wb_inode; -- cgit