Module: wine Branch: master Commit: 68edddc98b8b48369aa1f0c3fb1aefa6e5b37e66 URL: https://gitlab.winehq.org/wine/wine/-/commit/68edddc98b8b48369aa1f0c3fb1aefa...
Author: Eric Pouech epouech@codeweavers.com Date: Tue Nov 7 19:08:57 2023 +0100
pdh: Zero out magic fields with SecureZeroMemory().
gcc tends to optimize away the magic field cleanup, leading to believe the query is still allocated.
Signed-off-by: Eric Pouech epouech@codeweavers.com
---
dlls/pdh/pdh_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c index 073a74e1b52..12bda6bedc0 100644 --- a/dlls/pdh/pdh_main.c +++ b/dlls/pdh/pdh_main.c @@ -97,7 +97,8 @@ static struct counter *create_counter( void )
static void destroy_counter( struct counter *counter ) { - counter->magic = 0; + /* Ensure compiler doesn't optimize out the assignment with 0. */ + SecureZeroMemory( &counter->magic, sizeof( counter->magic ) ); free( counter->path ); free( counter ); } @@ -130,7 +131,8 @@ static struct query *create_query( void )
static void destroy_query( struct query *query ) { - query->magic = 0; + /* Ensure compiler doesn't optimize out the assignment with 0. */ + SecureZeroMemory( &query->magic, sizeof( query->magic ) ); free( query ); }