diff options
| -rw-r--r-- | src/core/endpt.c | 8 | ||||
| -rw-r--r-- | src/core/idhash.c | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c index e54e423c..034e1a3d 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -29,7 +29,7 @@ nni_endpt_create(nni_endpt **epp, nni_socket *sock, const char *addr) return (NNG_EINVAL); } - if ((ep = nni_alloc(sizeof (*ep))) == NULL) { + if ((ep = NNI_ALLOC_STRUCT(ep)) == NULL) { return (NNG_ENOMEM); } ep->ep_sock = sock; @@ -39,7 +39,7 @@ nni_endpt_create(nni_endpt **epp, nni_socket *sock, const char *addr) NNI_LIST_NODE_INIT(&ep->ep_node); if ((rv = nni_cv_init(&ep->ep_cv, &ep->ep_sock->s_mx)) != 0) { - nni_free(ep, sizeof (*ep)); + NNI_FREE_STRUCT(ep); return (NNG_ENOMEM); } @@ -50,7 +50,7 @@ nni_endpt_create(nni_endpt **epp, nni_socket *sock, const char *addr) rv = ep->ep_ops.ep_create(&ep->ep_data, addr, nni_socket_proto(sock)); if (rv != 0) { nni_cv_fini(&ep->ep_cv); - nni_free(ep, sizeof (*ep)); + NNI_FREE_STRUCT(ep); return (rv); } @@ -91,7 +91,7 @@ nni_endpt_close(nni_endpt *ep) ep->ep_ops.ep_destroy(ep->ep_data); nni_cv_fini(&ep->ep_cv); - nni_free(ep, sizeof (*ep)); + NNI_FREE_STRUCT(ep); } diff --git a/src/core/idhash.c b/src/core/idhash.c index 785f3835..58b68bbf 100644 --- a/src/core/idhash.c +++ b/src/core/idhash.c @@ -32,12 +32,12 @@ nni_idhash_create(nni_idhash **hp) { nni_idhash *h; - if ((h = nni_alloc(sizeof (*h))) == NULL) { + if ((h = NNI_ALLOC_STRUCT(h)) == NULL) { return (NNG_ENOMEM); } h->ih_entries = nni_alloc(8 * sizeof (nni_idhash_entry)); if (h->ih_entries == NULL) { - nni_free(h, sizeof (*h)); + NNI_FREE_STRUCT(h); return (NNG_ENOMEM); } (void) memset(h->ih_entries, 0, (8 * sizeof (nni_idhash_entry))); @@ -56,7 +56,7 @@ void nni_idhash_destroy(nni_idhash *h) { nni_free(h->ih_entries, h->ih_cap * sizeof (nni_idhash_entry)); - nni_free(h, sizeof (*h)); + NNI_FREE_STRUCT(h); } |
