WPP: Fixed 'out of tree' compilation

Alexandre Julliard julliard at winehq.org
Wed Jan 5 07:35:33 CST 2005


Jacek Caban <jack at itma.pwr.wroc.pl> writes:

> --- libs/wpp/ppy.y	1 May 2003 03:16:21 -0000	1.1
> +++ libs/wpp/ppy.y	30 Dec 2004 10:11:39 -0000
> @@ -537,7 +537,10 @@ static int boolean(cval_t *v)
>  static marg_t *new_marg(char *str, def_arg_t type)
>  {
>  	marg_t *ma = pp_xmalloc(sizeof(marg_t));
> -	ma->arg = str;
> +	if(str)
> +		ma->arg = pp_xstrdup(str);
> +	else
> +		ma->arg = NULL;
>  	ma->type = type;
>  	ma->nnl = 0;
>  	return ma;
> @@ -569,7 +572,7 @@ static mtext_t *new_mtext(char *str, int
>  	if(str == NULL)
>  		mt->subst.argidx = idx;
>  	else
> -		mt->subst.text = str;
> +		mt->subst.text = pp_xstrdup(str);

AFAICS the string is already duplicated everywhere these functions are
called, so you are adding a memory leak here. Does this patch really
make a difference in the behavior?

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list