diff options
author | Nandaja Varma <nandaja.varma@gmail.com> | 2015-02-06 11:44:22 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-04-10 11:29:42 +0000 |
commit | 26cbd3bdf5dad190559afbdf0ac125262c4e90a6 (patch) | |
tree | 9d8fed20e8d46f33e9dddd321ca014917d473c06 /rpc | |
parent | 320455bddfbadcfbe1b173b0de54b3b25bf228f7 (diff) |
rpc-lib: Fixing the coverity issues
Coverity CIDs:
1210973
1124887
1124888
1124682
1124849
1124503
Change-Id: I012f6cf9d14753f572ab94aae6d442d1ef8df79a
BUG: 789278
Signed-off-by: Nandaja Varma <nandaja.varma@gmail.com>
Reviewed-on: http://review.gluster.org/9600
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt-ping.c | 9 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.c | 15 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpc-drc.c | 8 | ||||
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc-auth.c | 2 |
4 files changed, 14 insertions, 20 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt-ping.c b/rpc/rpc-lib/src/rpc-clnt-ping.c index 0b32990e31e..17f8874a6a4 100644 --- a/rpc/rpc-lib/src/rpc-clnt-ping.c +++ b/rpc/rpc-lib/src/rpc-clnt-ping.c @@ -237,7 +237,7 @@ rpc_clnt_ping (struct rpc_clnt *rpc) conn = &rpc->conn; frame = create_frame (THIS, THIS->ctx->pool); if (!frame) - goto fail; + return ret; frame->local = rpc; @@ -258,13 +258,6 @@ rpc_clnt_ping (struct rpc_clnt *rpc) return ret; -fail: - if (frame) { - STACK_DESTROY (frame->root); - } - - return ret; - } static void diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index 20981ef9c9c..264a3120a46 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -724,7 +724,7 @@ rpc_clnt_handle_cbk (struct rpc_clnt *clnt, rpc_transport_pollin_t *msg) } out: - clnt = rpc_clnt_unref (clnt); + rpc_clnt_unref (clnt); return ret; } @@ -774,7 +774,7 @@ out: mem_put (saved_frame); } - clnt = rpc_clnt_unref (clnt); + rpc_clnt_unref (clnt); return ret; } @@ -1455,11 +1455,12 @@ rpcclnt_cbk_program_register (struct rpc_clnt *clnt, program->progver); out: - if (ret == -1) { - gf_log (clnt->conn.name, GF_LOG_ERROR, - "Program registration failed:" - " %s, Num: %d, Ver: %d", program->progname, - program->prognum, program->progver); + if (ret == -1 && clnt) { + gf_log (clnt->conn.name, GF_LOG_ERROR, + "Program registration failed:" + " %s, Num: %d, Ver: %d", + program->progname, + program->prognum, program->progver); } return ret; diff --git a/rpc/rpc-lib/src/rpc-drc.c b/rpc/rpc-lib/src/rpc-drc.c index 6adadd85b0e..036b215e0c0 100644 --- a/rpc/rpc-lib/src/rpc-drc.c +++ b/rpc/rpc-lib/src/rpc-drc.c @@ -462,14 +462,14 @@ rpcsvc_add_op_to_cache (rpcsvc_drc_globals_t *drc, drc_cached_op_t *reply) rpcsvc_vacate_drc_entries (drc); tmp_reply = (drc_cached_op_t **)rb_probe (client->rbtree, reply); - if (*tmp_reply != reply) { + if (!tmp_reply) { + /* mem alloc failed */ + return -1; + } else if (*tmp_reply != reply) { /* should never happen */ gf_log (GF_RPCSVC, GF_LOG_ERROR, "DRC failed to detect duplicates"); return -1; - } else if (*tmp_reply == NULL) { - /* mem alloc failed */ - return -1; } client->op_count++; diff --git a/rpc/rpc-lib/src/rpcsvc-auth.c b/rpc/rpc-lib/src/rpcsvc-auth.c index 384e4a75db2..6b4c7937437 100644 --- a/rpc/rpc-lib/src/rpcsvc-auth.c +++ b/rpc/rpc-lib/src/rpcsvc-auth.c @@ -38,7 +38,7 @@ rpcsvc_auth_add_initer (struct list_head *list, char *idfier, } new->init = init; - strcpy (new->name, idfier); + strncpy (new->name, idfier, sizeof (new->name) - 1); INIT_LIST_HEAD (&new->authlist); list_add_tail (&new->authlist, list); return 0; |