summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-04-06 10:56:52 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-06 23:30:33 +0530
commit2d59bde99600ecb15b7ebba9cd0283925c9f20f4 (patch)
tree7fa1c79196238103d357ad6d0f838445076e8eda /xlators/storage/posix/src/posix.c
parentc7962678224374fa295d4063c2f5387c7280536e (diff)
fix to fd leak in posix_create() in case of some failures.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index e92f01cd6f2..9f4c42a1a31 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1371,7 +1371,6 @@ posix_create (call_frame_t *frame, xlator_t *this,
gf_log (this->name, GF_LOG_WARNING,
"chown on %s failed: %s",
real_path, strerror (op_errno));
- goto out;
}
#endif
@@ -1390,7 +1389,6 @@ posix_create (call_frame_t *frame, xlator_t *this,
op_errno = errno;
gf_log (this->name, GF_LOG_ERROR,
"out of memory :(");
- close (_fd);
goto out;
}
@@ -1406,6 +1404,9 @@ posix_create (call_frame_t *frame, xlator_t *this,
out:
SET_TO_OLD_FS_ID ();
+ if ((-1 == op_ret) && (_fd != -1))
+ close (_fd);
+
frame->root->rsp_refs = NULL;
STACK_UNWIND (frame, op_ret, op_errno, fd, loc->inode, &stbuf);