From c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 2 Jan 2017 11:26:43 -0800 Subject: Use new NNI_ALLOC_STRUCT macro. nni_msg_dup copies options too. --- src/protocol/reqrep/req.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/protocol/reqrep/req.c') diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c index 611baadb..6c8f8543 100644 --- a/src/protocol/reqrep/req.c +++ b/src/protocol/reqrep/req.c @@ -55,16 +55,16 @@ nni_req_create(void **reqp, nni_socket *sock) nni_req_sock *req; int rv; - if ((req = nni_alloc(sizeof (*req))) == NULL) { + if ((req = NNI_ALLOC_STRUCT(req)) == NULL) { return (NNG_ENOMEM); } if ((rv = nni_mtx_init(&req->mx)) != 0) { - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); return (rv); } if ((rv = nni_cv_init(&req->cv, &req->mx)) != 0) { nni_mtx_fini(&req->mx); - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); return (rv); } // this is "semi random" start for request IDs. @@ -84,7 +84,7 @@ nni_req_create(void **reqp, nni_socket *sock) if (rv != 0) { nni_cv_fini(&req->cv); nni_mtx_fini(&req->mx); - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); return (rv); } nni_thr_run(&req->resender); @@ -107,7 +107,7 @@ nni_req_destroy(void *arg) nni_thr_fini(&req->resender); nni_cv_fini(&req->cv); nni_mtx_fini(&req->mx); - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); } -- cgit v1.2.3-70-g09d2