* Fixed destruction order of lock/reference that could lead to access already

deleted memory.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35467 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-02-15 13:23:48 +00:00
parent 54f3267e78
commit 10cb62616f
1 changed files with 4 additions and 1 deletions

View File

@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include "UnixEndpoint.h"
#include <stdio.h>
@ -431,6 +432,8 @@ UnixEndpoint::Send(const iovec *vecs, size_t vecCount,
gStackModule->store_syscall_restart_timeout(timeout);
UnixEndpointLocker locker(this);
Reference<UnixEndpoint> peerReference;
UnixEndpointLocker peerLocker;
status_t error = _LockConnectedEndpoints(locker, peerLocker);
@ -438,7 +441,7 @@ UnixEndpoint::Send(const iovec *vecs, size_t vecCount,
RETURN_ERROR(error);
UnixEndpoint* peerEndpoint = fPeerEndpoint;
Reference<UnixEndpoint> peerReference(peerEndpoint);
peerReference.SetTo(peerEndpoint);
// lock the peer's FIFO
UnixFifo* peerFifo = peerEndpoint->fReceiveFifo;