[PATCH 05/14] rpcrt4: Write the function header into the procedure format string.

Huw Davies huw at codeweavers.com
Tue Nov 6 02:41:12 CST 2018


On Sat, Nov 03, 2018 at 06:07:17PM -0500, Zebediah Figura wrote:
> Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
> ---
>  dlls/rpcrt4/ndr_typelib.c | 180 +++++++++++++++++++++++++++++++++++++-
>  1 file changed, 179 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/rpcrt4/ndr_typelib.c b/dlls/rpcrt4/ndr_typelib.c
> index aa54db20e0..51e198d711 100644
> --- a/dlls/rpcrt4/ndr_typelib.c
> +++ b/dlls/rpcrt4/ndr_typelib.c
> @@ -22,6 +22,7 @@
> +static HRESULT write_iface_fs(ITypeInfo *typeinfo, WORD funcs,
> +        unsigned char *type, size_t *typelen, unsigned char *proc,
> +        size_t *proclen, unsigned short *offset)
> +{
> +    unsigned short stack_offset;
> +    WORD proc_idx, param_idx;
> +    FUNCDESC *desc;
> +    HRESULT hr;
> +
> +    for (proc_idx = 0; proc_idx < funcs; proc_idx++)
> +    {
> +        TRACE("proc %d\n", proc_idx);
> +
> +        hr = ITypeInfo_GetFuncDesc(typeinfo, proc_idx, &desc);
> +        if (FAILED(hr)) return hr;
> +
> +        if (offset)
> +            offset[proc_idx] = *proclen;
> +
> +        write_proc_func_header(typeinfo, desc, proc_idx + 3, proc, proclen);
> +
> +        stack_offset = sizeof(void *);  /* This */
> +        for (param_idx = 0; param_idx < desc->cParams; param_idx++)
> +        {
> +            TRACE("param %d\n", param_idx);
> +            hr = write_param_fs(typeinfo, type, typelen, proc, proclen,
> +                    &desc->lprgelemdescParam[param_idx], FALSE, &stack_offset);
> +            if (FAILED(hr)) return hr;

You leak desc in the failure case here.

> +        }
> +
> +        hr = write_param_fs(typeinfo, type, typelen, proc, proclen,
> +                &desc->elemdescFunc, TRUE, &stack_offset);
> +        if (FAILED(hr)) return hr;

Also here.

> +
> +        ITypeInfo_ReleaseFuncDesc(typeinfo, desc);
> +    }
> +
> +    return S_OK;
> +}



More information about the wine-devel mailing list