Module: wine Branch: master Commit: e12b487e2621816645a1f98a46249c2c9fa78f9c URL: http://source.winehq.org/git/wine.git/?a=commit;h=e12b487e2621816645a1f98a46...
Author: Rob Shearman rob@codeweavers.com Date: Wed Dec 12 14:48:51 2007 +0000
rpcrt4: Try to free every non-stack pointer in PointerFree now that NdrFree does the sanity checking for us.
---
dlls/rpcrt4/ndr_marshall.c | 14 ++++---------- dlls/rpcrt4/tests/ndr_marshall.c | 2 -- 2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 0fd2456..8c79751 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -1270,23 +1270,17 @@ static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg, m = NdrFreer[*desc & NDR_TABLE_MASK]; if (m) m(pStubMsg, Pointer, desc);
- /* we should check if the memory comes from NdrAllocate, - * and deallocate only if so - checking if the pointer is between - * BufferStart and BufferEnd will not always work since the buffer - * may be reallocated when the server wants to marshal the reply */ - if (Pointer >= (unsigned char *)pStubMsg->RpcMsg->Buffer || - Pointer <= (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) - goto notfree; - if (attr & RPC_FC_P_ONSTACK) { TRACE("not freeing stack ptr %p\n", Pointer); return; } + + /* try to free everything else. NdrFree will do the job of sorting out + * whether we allocated it or whether the app did */ + TRACE("freeing %p\n", Pointer); NdrFree(pStubMsg, Pointer); return; -notfree: - TRACE("not freeing %p\n", Pointer); }
/*********************************************************************** diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c index 42929d9..f0028bd 100644 --- a/dlls/rpcrt4/tests/ndr_marshall.c +++ b/dlls/rpcrt4/tests/ndr_marshall.c @@ -1193,9 +1193,7 @@ todo_wine { my_free_called = 0; StubMsg.Buffer = StubMsg.BufferStart; NdrPointerFree( &StubMsg, mem, fmtstr_conf_str ); -todo_wine { ok(my_free_called == 1, "free called %d\n", my_free_called); -}
/* Server */ my_alloc_called = 0;