From ecb58c9a3f716a87da7174c1aa721561b18ad27b Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Fri, 28 Nov 2014 17:54:52 +0530 Subject: api, glusterfsd: Cleanup upon failure in glusterfs_ctx_defaults_init() This got introduced due to 656711d935000c16. Coverity also picked this up as CIDs 1256176, 1256178, 1256180. Signed-off-by: Vijay Bellur Change-Id: If12fa0075634383975846181917a2f9650f790e3 BUG: 789278 Reviewed-on: http://review.gluster.org/9213 Tested-by: Gluster Build System Reviewed-by: Niels de Vos Reviewed-by: Shyamsundar Ranganathan --- glusterfsd/src/glusterfsd.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index c23e83257e1..e854959daf6 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1319,6 +1319,12 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) gf_msg(THIS->name, GF_LOG_CRITICAL, 0, glusterfsd_msg_34); return ret; } + + /* reset ret to -1 so that we don't need to explicitly + * set it in all error paths before "goto err" + */ + ret = -1; + ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) { gf_msg ("", GF_LOG_CRITICAL, 0, glusterfsd_msg_13); -- cgit