widl: Output server code for freeing returned types.

This commit is contained in:
Rob Shearman 2009-03-07 23:23:48 +00:00 committed by Alexandre Julliard
parent 23673ca373
commit f170f9b5d5
2 changed files with 18 additions and 3 deletions

View File

@ -80,6 +80,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset)
indent++;
write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE);
if (!is_void(type_function_get_rettype(func->type)))
write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_FREE);
if (has_full_pointer)
write_full_pointer_free(server, indent, func);

View File

@ -3349,9 +3349,14 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
if (phase == PHASE_FREE || pass == PASS_RETURN ||
pointer_type != RPC_FC_RP)
{
unsigned int ptr_start_offset = (start_offset - (is_conformant_array(type) ? 4 : 2));
print_phase_function(file, indent, "Pointer", local_var_prefix,
phase, var, ptr_start_offset);
/* strings returned are assumed to be global and hence don't
* need freeing */
if (phase != PHASE_FREE || pass != PASS_RETURN)
{
unsigned int ptr_start_offset = (start_offset - (is_conformant_array(type) ? 4 : 2));
print_phase_function(file, indent, "Pointer", local_var_prefix,
phase, var, ptr_start_offset);
}
}
else
{
@ -3493,6 +3498,13 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
* need a freeing pass */
if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
struct_type = "SimpleStruct";
else if (phase == PHASE_FREE && pass == PASS_RETURN)
{
print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name);
indent++;
print_file(file, indent, "__frame->_StubMsg.pfnFree(%s%s);\n", local_var_prefix, var->name);
indent--;
}
break;
case RPC_FC_PSTRUCT:
struct_type = "SimpleStruct";