Re: Malloc bugs in build tools
Peter Hunnisett <[email protected]>
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Message-ID | <[email protected]> |
Seth,
this list is now defunct. Please use the ones at www.transgaming.org
in the future.
Regards,
Peter
Seth Kingsley wrote:
>On FreeBSD-CURRENT, the malloc() interface marks all free'd memory with
>a bit-pattern of 0xd0d0d0..., and calls abort() when an invalid pointer
>is passed to free(). This results in build errors when compiling WineX
>from CVS. The following patch tries to fix malloc/free uses in the
>build tools:
>
>In the first case, add_token() is removing storage for the yacc stack
>item ($1) before input validation is done. You can see similar examples
>where this order is used (check value, add token) in other places in the
>parse tree.
>
>The second case is the only place in the tools/wrc source where the
>string_t object returned by convert_string() is free'd manually, since
>it is already destroyed before put_string() returns. This results in a
>double-free.
>
>Index: tools/wmc/mcy.y
>===================================================================
>RCS file: /cvsroot/winex/tools/wmc/mcy.y,v
>retrieving revision 1.1.1.2
>diff -u -d -p -r1.1.1.2 mcy.y
>--- tools/wmc/mcy.y 28 Oct 2001 14:21:13 -0000 1.1.1.2
>+++ tools/wmc/mcy.y 1 Dec 2003 18:35:38 -0000
>@@ -212,9 +212,9 @@ lmap : token '=' tNUMBER setfile ':' tFI
> $1->token = $3;
> $1->alias = $6;
> $1->codepage = $7;
>- do_add_token(tok_language, $1, "language");
> if(!find_language($1->token) && !find_cpxlat($1->token))
> yywarning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", $1->token, WMC_DEFAULT_CODEPAGE);
>+ do_add_token(tok_language, $1, "language");
> }
> | token '=' tNUMBER setfile ':' error { xyyerror("Filename expected"); }
> | token '=' tNUMBER error { xyyerror(err_colon); }
>Index: tools/wrc/genres.c
>===================================================================
>RCS file: /cvsroot/winex/tools/wrc/genres.c,v
>retrieving revision 1.1.1.5
>diff -u -d -p -r1.1.1.5 genres.c
>--- tools/wrc/genres.c 25 Sep 2002 19:24:22 -0000 1.1.1.5
>+++ tools/wrc/genres.c 1 Dec 2003 18:35:42 -0000
>@@ -1475,7 +1475,6 @@ static res_t *stringtable2res(stringtabl
> else
> put_byte(res, str->size);
> put_string(res, str, win32 ? str_unicode : str_char, FALSE);
>- free(str);
> }
> else
> {
>
>
>
>