mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-15 16:44:36 +02:00
8298852: Use of uninitialized memory in MetadataFactory::free_metadata
Reviewed-by: coleenp, stefank, dholmes
This commit is contained in:
parent
ac2fcf3f75
commit
f4caaca100
1 changed files with 2 additions and 1 deletions
|
@ -70,6 +70,7 @@ class MetadataFactory : AllStatic {
|
||||||
assert(!md->on_stack(), "can't deallocate things on stack");
|
assert(!md->on_stack(), "can't deallocate things on stack");
|
||||||
assert(!md->is_shared(), "cannot deallocate if in shared spaces");
|
assert(!md->is_shared(), "cannot deallocate if in shared spaces");
|
||||||
md->deallocate_contents(loader_data);
|
md->deallocate_contents(loader_data);
|
||||||
|
bool is_klass = md->is_klass();
|
||||||
// Call the destructor. This is currently used for MethodData which has a member
|
// Call the destructor. This is currently used for MethodData which has a member
|
||||||
// that needs to be destructed to release resources. Most Metadata derived classes have noop
|
// that needs to be destructed to release resources. Most Metadata derived classes have noop
|
||||||
// destructors and/or cleanup using deallocate_contents.
|
// destructors and/or cleanup using deallocate_contents.
|
||||||
|
@ -77,7 +78,7 @@ class MetadataFactory : AllStatic {
|
||||||
// or volatile so we can call the destructor of the type T points to.
|
// or volatile so we can call the destructor of the type T points to.
|
||||||
using U = std::remove_cv_t<T>;
|
using U = std::remove_cv_t<T>;
|
||||||
md->~U();
|
md->~U();
|
||||||
loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass());
|
loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, is_klass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue