summaryrefslogtreecommitdiff
path: root/src/core/endpt.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-31 14:51:59 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-31 14:51:59 -0800
commitd8ffb0b277e7f5d5edc17585543ee78921efc077 (patch)
treecbda6c0b04da33d028f0b234bc8f536cbe74cea8 /src/core/endpt.c
parentc1e9b7ed8dec2e9aab6a00966e0f173a39795814 (diff)
downloadnng-d8ffb0b277e7f5d5edc17585543ee78921efc077.tar.gz
nng-d8ffb0b277e7f5d5edc17585543ee78921efc077.tar.bz2
nng-d8ffb0b277e7f5d5edc17585543ee78921efc077.zip
More use after free.
Diffstat (limited to 'src/core/endpt.c')
-rw-r--r--src/core/endpt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/endpt.c b/src/core/endpt.c
index d077122d..67d17cea 100644
--- a/src/core/endpt.c
+++ b/src/core/endpt.c
@@ -55,6 +55,11 @@ nni_endpt_create(nni_endpt **epp, nni_socket *sock, const char *addr)
nni_free(ep, sizeof (*ep));
return (rv);
}
+
+ nni_mutex_enter(&sock->s_mx);
+ nni_list_append(&sock->s_eps, ep);
+ nni_mutex_exit(&sock->s_mx);
+
*epp = ep;
return (0);
}
@@ -78,6 +83,7 @@ nni_endpt_close(nni_endpt *ep)
ep->ep_pipe = NULL;
}
nni_cond_broadcast(&ep->ep_cv);
+ nni_list_remove(&ep->ep_sock->s_eps, ep);
nni_mutex_exit(mx);
if (ep->ep_dialer != NULL) {