summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/locks/src/common.c7
-rw-r--r--xlators/features/quota/src/quota.c3
-rw-r--r--xlators/performance/write-behind/src/write-behind.c7
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c4
4 files changed, 18 insertions, 3 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);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index e67a4325fc7..22d1bb9f30f 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -40,10 +40,11 @@ __quota_init_inode_ctx (inode_t *inode, xlator_t *this,
INIT_LIST_HEAD (&ctx->parents);
ret = __inode_ctx_put (inode, this, (uint64_t )(long)ctx);
- if (ret == -1) {
+ if (ret) {
gf_msg (this->name, GF_LOG_WARNING, 0,
Q_MSG_INODE_CTX_SET_FAILED, "cannot set quota context "
"in inode (gfid:%s)", uuid_utoa (inode->gfid));
+ GF_FREE (ctx);
}
out:
return ret;
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;
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index 3f4d40af48e..ed117b809cb 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -310,6 +310,10 @@ __posix_acl_ctx_get (inode_t *inode, xlator_t *this, gf_boolean_t create)
return NULL;
ret = __inode_ctx_put (inode, this, UINT64 (ctx));
+ if (ret) {
+ GF_FREE (ctx);
+ ctx = NULL;
+ }
return ctx;
}