aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep/rep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocol/reqrep/rep.c')
-rw-r--r--src/protocol/reqrep/rep.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c
index 90346236..6410e6db 100644
--- a/src/protocol/reqrep/rep.c
+++ b/src/protocol/reqrep/rep.c
@@ -72,11 +72,13 @@ nni_rep_sock_fini(void *arg)
{
nni_rep_sock *rep = arg;
- nni_idhash_destroy(rep->pipes);
- if (rep->btrace != NULL) {
- nni_free(rep->btrace, rep->btrace_len);
+ if (rep != NULL) {
+ nni_idhash_destroy(rep->pipes);
+ if (rep->btrace != NULL) {
+ nni_free(rep->btrace, rep->btrace_len);
+ }
+ NNI_FREE_STRUCT(rep);
}
- NNI_FREE_STRUCT(rep);
}
@@ -106,8 +108,10 @@ nni_rep_pipe_fini(void *arg)
{
nni_rep_pipe *rp = arg;
- nni_msgq_fini(rp->sendq);
- NNI_FREE_STRUCT(rp);
+ if (rp != NULL) {
+ nni_msgq_fini(rp->sendq);
+ NNI_FREE_STRUCT(rp);
+ }
}