From 0aba10cb8c4de9fa31b7561281ce1d26626c66e4 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Thu, 19 Jan 2023 00:18:01 +0100 Subject: [PATCH] Fix dynamic class zeroing Recent change in the `ThreadLocalModule::AllocateDynamicClass` has accidentally removed zeroing for new CollectibleDynamicEntry instances. That leads to crashes when running code in an unloadable context. This change fixes that. --- src/coreclr/vm/threadstatics.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/vm/threadstatics.h b/src/coreclr/vm/threadstatics.h index a7001edd2d264..f002f0059ce6f 100644 --- a/src/coreclr/vm/threadstatics.h +++ b/src/coreclr/vm/threadstatics.h @@ -96,9 +96,9 @@ struct ThreadLocalModule LIMITED_METHOD_CONTRACT; } - LOADERHANDLE m_hGCStatics; - LOADERHANDLE m_hNonGCStatics; - PTR_LoaderAllocator m_pLoaderAllocator; + LOADERHANDLE m_hGCStatics = NULL; + LOADERHANDLE m_hNonGCStatics = NULL; + PTR_LoaderAllocator m_pLoaderAllocator = NULL; }; typedef DPTR(CollectibleDynamicEntry) PTR_CollectibleDynamicEntry;