From 2fc6834e7a5d721e97a47f3ebaa201902af73c5a Mon Sep 17 00:00:00 2001 From: linbaiye Date: Thu, 20 Sep 2012 12:37:29 +0800 Subject: Prevent fuse from setting an invalid value of fd_ctx This patch is used to prevent __fd_ctx_set() from setting an invalid value. Change-Id: I6756d83eab20fc485b3696ae341e21324f1c885c BUG: 789278 Signed-off-by: linbaiye Reviewed-on: http://review.gluster.org/3961 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi --- xlators/mount/fuse/src/fuse-bridge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xlators/mount/fuse') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 9bf07bf18b9..234af8041c2 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -58,7 +58,9 @@ __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) if (fd_ctx == NULL) { fd_ctx = GF_CALLOC (1, sizeof (*fd_ctx), gf_fuse_mt_fd_ctx_t); - + if (!fd_ctx) { + goto out; + } ret = __fd_ctx_set (fd, this, (uint64_t)(unsigned long)fd_ctx); if (ret < 0) { @@ -68,7 +70,7 @@ __fuse_fd_ctx_check_n_create (xlator_t *this, fd_t *fd) fd_ctx = NULL; } } - +out: return fd_ctx; } -- cgit