Author: cwittich
Date: Fri Jan 18 14:17:50 2008
New Revision: 31854
URL: http://svn.reactos.org/svn/reactos?rev=31854&view=rev
Log:
widl: Fix context handle "cannot be null" detection.
The "cannot be null" attibute is applied to a parameter if and only if
it is in-only.
widl: Fix the conditions under which array freeing code is output.
It doesn't matter whether or not the array is declared as a pointer or
is declared using array subscripts - the array is still allocated by the
unmarshalling function and so needs to be freed.
<rob at codeweavers.com>
Modified:
trunk/reactos/tools/widl/typegen.c
Modified: trunk/reactos/tools/widl/typegen.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=3…
==============================================================================
--- trunk/reactos/tools/widl/typegen.c (original)
+++ trunk/reactos/tools/widl/typegen.c Fri Jan 18 14:17:50 2008
@@ -2059,13 +2059,13 @@
unsigned char flags = 0x08 /* strict */;
if (is_ptr(type))
- {
flags |= 0x80;
- if (type->type != RPC_FC_RP)
+ if (is_attr(var->attrs, ATTR_IN))
+ {
+ flags |= 0x40;
+ if (!is_attr(var->attrs, ATTR_OUT))
flags |= 0x01;
}
- if (is_attr(var->attrs, ATTR_IN))
- flags |= 0x40;
if (is_attr(var->attrs, ATTR_OUT))
flags |= 0x20;
@@ -2807,15 +2807,13 @@
if (pointer_type != RPC_FC_RP) array_type = "Pointer";
print_phase_function(file, indent, array_type, phase, var, start_offset);
- if (phase == PHASE_FREE && type->declarray && pointer_type == RPC_FC_RP)
- {
- /* these are all unmarshalled by pointing into the buffer on the
- * server side */
+ if (phase == PHASE_FREE && pointer_type == RPC_FC_RP)
+ {
+ /* these are all unmarshalled by allocating memory */
if (type->type == RPC_FC_BOGUS_ARRAY ||
type->type == RPC_FC_CVARRAY ||
- (type->type == RPC_FC_SMVARRAY && type->type == RPC_FC_LGVARRAY && in_attr) ||
- (type->type == RPC_FC_CARRAY && type->type == RPC_FC_CARRAY && !in_attr))
- {
+ ((type->type == RPC_FC_SMVARRAY || type->type == RPC_FC_LGVARRAY) && in_attr) ||
+ (type->type == RPC_FC_CARRAY && !in_attr)) {
print_file(file, indent, "if (%s)\n", var->name);
indent++;
print_file(file, indent, "_StubMsg.pfnFree(%s);\n", var->name);
Author: cwittich
Date: Fri Jan 18 13:37:37 2008
New Revision: 31852
URL: http://svn.reactos.org/svn/reactos?rev=31852&view=rev
Log:
rpcrt4: Fix memory leak in NdrFullPointerXlatFree. <rob at codeweavers.com>
First of all, the code was freeing the wrong pointer (i.e. the pointer
supplied by the caller of one of the NdrFullPointer* functions, not the
PFULL_PTR_TO_REFID_ELEMENT. Second, the code wasn't following the Next
link to the next entry in the list.
Modified:
trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c
Modified: trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/ndr_fullp…
==============================================================================
--- trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c (original)
+++ trunk/reactos/dll/win32/rpcrt4/ndr_fullpointer.c Fri Jan 18 13:37:37 2008
@@ -68,8 +68,17 @@
TRACE("(%p)\n", pXlatTables);
/* free the entries in the table */
- for (i = 0; i < pXlatTables->RefIdToPointer.NumberOfEntries; i++)
- HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.XlatTable[i]);
+ for (i = 0; i < pXlatTables->PointerToRefId.NumberOfBuckets; i++)
+ {
+ PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
+ for (XlatTableEntry = pXlatTables->PointerToRefId.XlatTable[i];
+ XlatTableEntry; )
+ {
+ PFULL_PTR_TO_REFID_ELEMENT Next = XlatTableEntry->Next;
+ HeapFree(GetProcessHeap(), 0, XlatTableEntry);
+ XlatTableEntry = Next;
+ }
+ }
HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.XlatTable);
HeapFree(GetProcessHeap(), 0, pXlatTables->RefIdToPointer.StateTable);