From c1b41411c248f181c7ff5e97966ca550bf46732c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Mon, 16 Jun 2014 16:31:06 +0000 Subject: [PATCH] [RPCRT4] - Free parameters allocated by application before anything else. See CORE-8200 #comment committed in r63605, waiting for wine to accept it before closing. svn path=/trunk/; revision=63605 --- reactos/dll/win32/rpcrt4/ndr_stubless.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/rpcrt4/ndr_stubless.c b/reactos/dll/win32/rpcrt4/ndr_stubless.c index e43ddde805b..72a853701d8 100644 --- a/reactos/dll/win32/rpcrt4/ndr_stubless.c +++ b/reactos/dll/win32/rpcrt4/ndr_stubless.c @@ -1079,6 +1079,19 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, unsigned int i; LONG_PTR *retval_ptr = NULL; + if (phase == STUBLESS_FREE) + { + /* Process the params allocated by the application first */ + for (i = 0; i < number_of_params; i++) + { + unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset; + if (params[i].attr.MustFree) + { + call_freer(pStubMsg, pArg, ¶ms[i]); + } + } + } + for (i = 0; i < number_of_params; i++) { unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset; @@ -1096,11 +1109,7 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, call_marshaller(pStubMsg, pArg, ¶ms[i]); break; case STUBLESS_FREE: - if (params[i].attr.MustFree) - { - call_freer(pStubMsg, pArg, ¶ms[i]); - } - else if (params[i].attr.ServerAllocSize) + if (params[i].attr.ServerAllocSize) { HeapFree(GetProcessHeap(), 0, *(void **)pArg); } -- 2.17.1