aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep/req.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/reqrep/req.c')
-rw-r--r--src/protocol/reqrep/req.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c
index 73ef4969..787997e8 100644
--- a/src/protocol/reqrep/req.c
+++ b/src/protocol/reqrep/req.c
@@ -89,14 +89,16 @@ nni_req_sock_fini(void *arg)
{
nni_req_sock *req = arg;
- nni_cv_fini(&req->cv);
- if (req->reqmsg != NULL) {
- nni_msg_free(req->reqmsg);
- }
- if (req->retrymsg != NULL) {
- nni_msg_free(req->retrymsg);
+ if (req != NULL) {
+ nni_cv_fini(&req->cv);
+ if (req->reqmsg != NULL) {
+ nni_msg_free(req->reqmsg);
+ }
+ if (req->retrymsg != NULL) {
+ nni_msg_free(req->retrymsg);
+ }
+ NNI_FREE_STRUCT(req);
}
- NNI_FREE_STRUCT(req);
}
@@ -121,7 +123,9 @@ nni_req_pipe_fini(void *arg)
{
nni_req_pipe *rp = arg;
- NNI_FREE_STRUCT(rp);
+ if (rp != NULL) {
+ NNI_FREE_STRUCT(rp);
+ }
}