Skip to content

Commit c8cab54

Browse files
committed
meta: Prevent memory hoarding for GetClass("int")
or any other numerical types.
1 parent 04ba948 commit c8cab54

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/meta/src/TClass.cxx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,6 +3160,19 @@ TClass *TClass::GetClass(const char *name, Bool_t load, Bool_t silent, size_t hi
31603160
Bool_t nameChanged = kFALSE;
31613161

31623162
if (!cl) {
3163+
// First look at known types but without triggering any loads
3164+
{
3165+
THashTable *typeTable = dynamic_cast<THashTable *>(gROOT->GetListOfTypes());
3166+
TDataType *type = (TDataType *)typeTable->THashTable::FindObject(name);
3167+
if (type) {
3168+
if (type->GetType() > 0)
3169+
// This is a numerical type
3170+
return nullptr;
3171+
// This is a typedef
3172+
normalizedName = type->GetTypeName();
3173+
nameChanged = kTRUE;
3174+
}
3175+
}
31633176
{
31643177
TInterpreter::SuspendAutoLoadingRAII autoloadOff(gInterpreter);
31653178
TClassEdit::GetNormalizedName(normalizedName, name);

0 commit comments

Comments
 (0)