wined3d: fix memory leak in arb program tracking when compiled with MSVC in release mode.

Leonid Lobachev Leonid.Lobachev at Sun.COM
Tue Jul 21 05:40:11 CDT 2009


MSVC adds padding to the struct ffp_frag_setting, those padding bytes 
aren't initialized in gen_ffp_frag_op,
which in turn leads to a structures with random bytes being added to the 
red/black tree (priv->fragment_shaders) in fragment_prog_arbfp.
Tree comparison function ffp_frag_program_key_compare does memcmp of 
those structures, which leads to unpredictable results due to those 
random bytes.
In practice certain apps (like unrealII) will eat up memory allocating 
several thousands exactly the same shader programs.
It could be solved also by adding pack pragma to the structure 
declaration but it's not a best way to go IMHO.
PS. Ofc, problem doesn't occur in debug builds, because MSVC fills 
uninitialized memory with fixed values.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20090721/fc64cce2/attachment.txt>


More information about the wine-patches mailing list