WPP: Fixed 'out of tree' compilation

Jacek Caban jack at itma.pwr.wroc.pl
Wed Jan 5 13:09:10 CST 2005


Alexandre Julliard wrote:

>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?
>
>  
>
Now I see, it is duplicated. As I wrote, I couldn't reproduce this 
situation.
I know only that it makes widl work for Dan Kegel and Stefan Leichter, 
as they
reported, but, as often with memory overflow, it can be just a consident.
Now I see that the bug is not here. The best way to find the bug would be to
debug widl with the malloc debug library, but as it doesn't crash on my box,
I'm not able to do it.

Thanks,
    Jacek



More information about the wine-devel mailing list