summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/rdma/src/rdma.c
diff options
context:
space:
mode:
authorBhumika Goyal <bgoyal@redhat.com>2018-10-18 14:15:40 +0530
committerAmar Tumballi <amarts@redhat.com>2018-10-21 05:51:41 +0000
commitc5f5ce2a9b1c085209cae21a7e1df5f60bc1a7da (patch)
tree1537e1caec68730d791a64ac8f4eebf1d4783e38 /rpc/rpc-transport/rdma/src/rdma.c
parent59629f1da9dca670d5dcc6425f7f89b3e96b46bf (diff)
rdma: coverity fixes
Fixes CID: 1382442 1382415 1382379 1382355 Change-Id: Ia712e37cb5a6db452d3178386394f87f83b85d38 updates: bz#789278 Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
Diffstat (limited to 'rpc/rpc-transport/rdma/src/rdma.c')
-rw-r--r--rpc/rpc-transport/rdma/src/rdma.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c
index d5d93d1..26cf201 100644
--- a/rpc/rpc-transport/rdma/src/rdma.c
+++ b/rpc/rpc-transport/rdma/src/rdma.c
@@ -3032,7 +3032,7 @@ gf_rdma_unregister_peer(gf_rdma_device_t *device, int32_t qp_num)
ent = qpreg->ents[hash].next;
while ((ent != &qpreg->ents[hash]) && (ent->qp_num != qp_num))
ent = ent->next;
- if (ent->qp_num != qp_num) {
+ if ((ent->qp_num != qp_num) || (ent == &qpreg->ents[hash])) {
pthread_mutex_unlock(&qpreg->lock);
return;
}
@@ -3311,9 +3311,6 @@ gf_rdma_decode_error_msg(gf_rdma_peer_t *peer, gf_rdma_post_t *post,
goto out;
}
- iobref_add(iobref, iobuf);
- iobuf_unref(iobuf);
-
ret = rpc_reply_to_xdr(&rpc_msg, iobuf_ptr(iobuf), iobuf_pagesize(iobuf),
&post->ctx.vector[0]);
if (ret == -1) {
@@ -3324,6 +3321,9 @@ gf_rdma_decode_error_msg(gf_rdma_peer_t *peer, gf_rdma_post_t *post,
goto out;
}
+ iobref_add(iobref, iobuf);
+ iobuf_unref(iobuf);
+
post->ctx.count = 1;
iobuf = NULL;
@@ -3445,7 +3445,8 @@ out:
GF_FREE(*readch);
*readch = NULL;
}
-
+ if (reply_info)
+ GF_FREE(reply_info);
GF_FREE(write_ary);
}
@@ -3553,10 +3554,10 @@ gf_rdma_do_reads(gf_rdma_peer_t *peer, gf_rdma_post_t *post,
}
}
+ ptr = iobuf_ptr(iobuf);
iobref_add(post->ctx.iobref, iobuf);
iobuf_unref(iobuf);
- ptr = iobuf_ptr(iobuf);
iobuf = NULL;
pthread_mutex_lock(&priv->write_mutex);