[metadata] Don't free_aggregate_modifiers in mono_metadata_free_type (#13785)
commitc434294b24ea90a86d92c7bae658e927242ad9b0
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Fri, 5 Apr 2019 15:01:24 +0000 (5 11:01 -0400)
committerGitHub <noreply@github.com>
Fri, 5 Apr 2019 15:01:24 +0000 (5 11:01 -0400)
treee3c6c79d07beb607e111196d776ff9d87660aaf0
parent36c5f3f3704c86ed67673afdfe74268e0337b1f0
[metadata] Don't free_aggregate_modifiers in mono_metadata_free_type (#13785)

The aggregate modifiers container is owned by a MonoImageSet.  The aggregate
modifiers may be shared by more than one MonoType that happen to need the same
modifiers. (Similar to how generic instantiations are shared)

When the image set is cleaned up the aggregate modifier cleanup will free the
types in the aggregate modifiers container (the call to
free_aggregate_modifiers in mono_metadata_clean_for_image).

With this extra call to free_aggregate_modifiers in mono_metadata_free_type may
cause the same memory to be freed twice.

Fixes https://github.com/mono/mono/issues/13775
mono/metadata/metadata.c