Skip to content

Commit 31039ff

Browse files
authored
Merge pull request #824 from Unity-Technologies/unity-master-load-assembly-raw-decrease-refcount
Remove extra reference count on images loaded via byte array (case 923165) case 923165 - Fix memory corruption/crash after domain reload when using Assembly.Load(Byte[])
2 parents 9c14da5 + 7c0dec0 commit 31039ff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mono/metadata/appdomain.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,9 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad,
21752175
return refass;
21762176
}
21772177

2178+
/* Clear the reference added by mono_image_open_from_data_full above */
2179+
mono_image_close (image);
2180+
21782181
refass = mono_assembly_get_object_handle (domain, ass, error);
21792182
if (!MONO_HANDLE_IS_NULL(refass))
21802183
MONO_HANDLE_SET (refass, evidence, evidence);

0 commit comments

Comments
 (0)