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
-- v2: pdh: Zero out magic fields with SecureZeroMemory().
From: Eric Pouech epouech@codeweavers.com
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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/pdh/pdh_main.c b/dlls/pdh/pdh_main.c index 073a74e1b52..a63c18e0bb4 100644 --- a/dlls/pdh/pdh_main.c +++ b/dlls/pdh/pdh_main.c @@ -97,7 +97,7 @@ static struct counter *create_counter( void )
static void destroy_counter( struct counter *counter ) { - counter->magic = 0; + SecureZeroMemory( &counter->magic, sizeof( counter->magic ) ); free( counter->path ); free( counter ); } @@ -130,7 +130,7 @@ static struct query *create_query( void )
static void destroy_query( struct query *query ) { - query->magic = 0; + SecureZeroMemory( &query->magic, sizeof( query->magic ) ); free( query ); }
On Tue Nov 7 09:31:12 2023 +0000, Hans Leidekker wrote:
We use [Rtl]SecureZeroMemory() elsewhere.
V2 pushed
Can we please have a comment in the code explaining why that's there?