Author: jgardou
Date: Mon Jun 16 16:31:06 2014
New Revision: 63605
URL:
http://svn.reactos.org/svn/reactos?rev=63605&view=rev
Log:
[RPCRT4]
- Free parameters allocated by application before anything else.
See CORE-8200 #comment committed in r63605, waiting for wine to accept it before closing.
Modified:
trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_stubl…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/rpcrt4/ndr_stubless.c [iso-8859-1] Mon Jun 16 16:31:06 2014
@@ -1079,6 +1079,19 @@
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 @@
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);
}