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>
This commit is contained in:
Nandaja Varma 2015-02-06 11:44:22 +05:30 committed by Vijay Bellur
parent 320455bddf
commit 26cbd3bdf5
4 changed files with 14 additions and 20 deletions

View File

@ -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

View File

@ -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;

View File

@ -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++;

View File

@ -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;