From 2d59bde99600ecb15b7ebba9cd0283925c9f20f4 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 6 Apr 2009 10:56:52 -0700 Subject: fix to fd leak in posix_create() in case of some failures. Signed-off-by: Anand V. Avati --- xlators/storage/posix/src/posix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators/storage/posix/src/posix.c') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index e92f01cd6..9f4c42a1a 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); -- cgit