[PATCH] Programs: fix extrac32 heap leak

Alex Henrie alexhenrie24 at gmail.com
Tue Dec 8 17:59:31 CST 2015


> diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c
> index 63205e8..a6e7438 100644
> --- a/programs/extrac32/extrac32.c
> +++ b/programs/extrac32/extrac32.c
> @@ -207,6 +207,8 @@ static LPWSTR *get_extrac_args(LPWSTR cmdline, int *pargc)
>         str++;
>     }
>
> +    HeapFree(GetProcessHeap(), 0, str);
> +
>     argv[argc] = NULL;
>     *pargc = argc;

I don't think this is right. Pointers to str are returned in the argv
array, and it's the caller's responsibility to free them. And in this
case, there's not much to be gained by freeing these pointers before
the end of the program anyway.

By the way, when writing patches for Wine programs in the future,
please use the name of the program as the component name. For example,
"extrac32: Fix heap leak."

-Alex



More information about the wine-devel mailing list