From 13f5bf063e5680966a4c0cff5b34b121ec69a70e Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Thu, 22 Mar 2012 06:46:04 +0100 Subject: Fix race condition in find_endpoint --- src/ctx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ctx.cpp b/src/ctx.cpp index 22c4908..21dec58 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -327,16 +327,16 @@ xs::endpoint_t xs::ctx_t::find_endpoint (const char *addr_) endpoint_t empty = {NULL, options_t()}; return empty; } - endpoint_t *endpoint = &it->second; + endpoint_t endpoint = it->second; // Increment the command sequence number of the peer so that it won't // get deallocated until "bind" command is issued by the caller. // The subsequent 'bind' has to be called with inc_seqnum parameter // set to false, so that the seqnum isn't incremented twice. - endpoint->socket->inc_seqnum (); + endpoint.socket->inc_seqnum (); endpoints_sync.unlock (); - return *endpoint; + return endpoint; } // The last used socket ID, or 0 if no socket was used so far. Note that this -- cgit v1.2.3