Author: axeld Date: 2010-02-15 14:23:48 +0100 (Mon, 15 Feb 2010) New Revision: 35467 Changeset: http://dev.haiku-os.org/changeset/35467/haiku Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp Log: * Fixed destruction order of lock/reference that could lead to access already deleted memory. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2010-02-15 13:22:58 UTC (rev 35466) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2010-02-15 13:23:48 UTC (rev 35467) @@ -3,6 +3,7 @@ * Distributed under the terms of the MIT License. */ + #include "UnixEndpoint.h" #include <stdio.h> @@ -431,6 +432,8 @@ gStackModule->store_syscall_restart_timeout(timeout); UnixEndpointLocker locker(this); + + Reference<UnixEndpoint> peerReference; UnixEndpointLocker peerLocker; status_t error = _LockConnectedEndpoints(locker, peerLocker); @@ -438,7 +441,7 @@ RETURN_ERROR(error); UnixEndpoint* peerEndpoint = fPeerEndpoint; - Reference<UnixEndpoint> peerReference(peerEndpoint); + peerReference.SetTo(peerEndpoint); // lock the peer's FIFO UnixFifo* peerFifo = peerEndpoint->fReceiveFifo;