1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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>
This commit is contained in:
Eric Pouech 2023-11-07 19:08:57 +01:00 committed by Alexandre Julliard
parent b3e0271b57
commit 68edddc98b

View file

@ -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 );
}