summaryrefslogtreecommitdiffstats
path: root/api/src
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2014-11-28 17:54:52 +0530
committerVijay Bellur <vbellur@redhat.com>2014-12-09 20:11:17 -0800
commitecb58c9a3f716a87da7174c1aa721561b18ad27b (patch)
tree13746f56975cabf0feaa01216099a6712427f07d /api/src
parent4aa63e28509eb47d293eddb4f61317d409598c23 (diff)
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 <vbellur@redhat.com> Change-Id: If12fa0075634383975846181917a2f9650f790e3 BUG: 789278 Reviewed-on: http://review.gluster.org/9213 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r--api/src/glfs.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 0dc535eb9e9..04ca7129e8e 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -68,13 +68,20 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
if (!ctx) {
goto err;
- }
- ret = xlator_mem_acct_init (THIS, glfs_mt_end + 1);
- if (ret != 0) {
- gf_log(THIS->name, GF_LOG_ERROR,
- "Memory accounting init failed");
- return ret;
- }
+ }
+
+ ret = xlator_mem_acct_init (THIS, glfs_mt_end + 1);
+ if (ret != 0) {
+ gf_log (THIS->name, GF_LOG_ERROR,
+ "Memory accounting init failed");
+ 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) {