Repository: flutter
Issue: Typography related objects on are leaked on shell launch.
Labels: engine,from: sanitizer,P2,team-engine,triaged-engine

Caught by leak sanitizer in the `shell_unittests` harness.

Leak of the CoreText object.
```
Direct leak of 8192 byte(s) in 8 object(s) allocated from:
    #0 0x1188a4393 in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x59393)
    #1 0x7fff4efd4616 in SetUpProgramPtrs(fsg_SplineKey*) (libTrueTypeScaler.dylib:x86_64+0x4616)
    #2 0x7fff4efd623b in TTGetStrikeSpecs (libTrueTypeScaler.dylib:x86_64+0x623b)
    #3 0x7fff4ee438b4 in TConcreteFontScaler::GetFontInfo(FPFontInfo*) const (libFontParser.dylib:x86_64+0x278b4)
    #4 0x7fff4ee73db1 in TFPFont::FillFontInfo(FPFontInfo&) const (libFontParser.dylib:x86_64+0x57db1)
    #5 0x7fff4ee21cb7 in TFPFont::GetFontInfo() const (libFontParser.dylib:x86_64+0x5cb7)
    #6 0x7fff4ee74dd0 in FPFontGetFontInfo (libFontParser.dylib:x86_64+0x58dd0)
    #7 0x7fff50d4d3df in get_font_info (CoreGraphics:x86_64h+0xe3df)
    #8 0x7fff510ff208 in get_font_info (CoreGraphics:x86_64h+0x3c0208)
    #9 0x7fff50d4d39a in CGFontGetNumberOfGlyphs (CoreGraphics:x86_64h+0xe39a)
    #10 0x7fff52539ee7 in TBaseFont::CopyGraphicsFont() const (CoreText:x86_64+0x13ee7)
    #11 0x7fff52592ca1 in TSplicedFont::CopyGraphicsFont() const (CoreText:x86_64+0x6cca1)
    #12 0x7fff52539e8f in TBaseFont::GetParserFont() const (CoreText:x86_64+0x13e8f)
    #13 0x7fff5253225f in TFont::InitVariationValues() (CoreText:x86_64+0xc25f)
    #14 0x7fff52531515 in TFont::FinishConstruction(CGFont*) (CoreText:x86_64+0xb515)
    #15 0x7fff5252fbf5 in CTFontCreateWithFontDescriptor (CoreText:x86_64+0x9bf5)
    #16 0x10ca4f92f in create_from_desc(__CTFontDescriptor const*) SkFontHost_mac.cpp:794
    #17 0x10ca4f217 in SkFontStyleSet_Mac::createTypeface(int) SkFontHost_mac.cpp:2527
    #18 0x10eabffbc in txt::FontCollection::CreateMinikinFontFamily(sk_sp<SkFontMgr> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) font_collection.cc:216
    #19 0x10eabe090 in txt::FontCollection::FindFontFamilyInManagers(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) font_collection.cc:193
    #20 0x10eabd256 in txt::FontCollection::GetMinikinFontCollectionForFamilies(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) font_collection.cc:155
    #21 0x10b2b7faa in flutter::testing::ShellTest_ReloadSystemFonts_Test::TestBody() shell_unittests.cc:539
    #22 0x11062d6b2 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2447
    #23 0x1105d84a9 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2502
    #24 0x1105d7ffc in testing::Test::Run() gtest.cc:2522
    #25 0x1105da189 in testing::TestInfo::Run() gtest.cc:2698
    #26 0x1105dc779 in testing::TestSuite::Run() gtest.cc:2828
    #27 0x1105f5521 in testing::internal::UnitTestImpl::RunAllTests() gtest.cc:5285
    #28 0x11063a7a2 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2447
    #29 0x1105f4800 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2502
```

Leak of the CoreGraphics font.
```
Indirect leak of 44 byte(s) in 1 object(s) allocated from:
    #0 0x11c640393 in wrap_malloc (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x59393)
    #1 0x7fff7c8f39b7 in _Block_copy (libsystem_blocks.dylib:x86_64+0x9b7)
    #2 0x7fff7c8f3a94 in _Block_object_assign (libsystem_blocks.dylib:x86_64+0xa94)
    #3 0x7fff7c8f39f2 in _Block_copy (libsystem_blocks.dylib:x86_64+0x9f2)
    #4 0x7fff7c85c5cf in _dispatch_Block_copy (libdispatch.dylib:x86_64+0x25cf)
    #5 0x7fff7c86e20d in _dispatch_source_set_handler (libdispatch.dylib:x86_64+0x1420d)
    #6 0x11c63f74e in wrap_dispatch_source_set_cancel_handler (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x5874e)
    #7 0x7fff51bcdd64 in connectToCoreServicesD() (CarbonCore:x86_64+0x1d64)
    #8 0x7fff51bcdc73 in getStatus() (CarbonCore:x86_64+0x1c73)
    #9 0x7fff51bcdbee in scCreateSystemServiceVersion (CarbonCore:x86_64+0x1bee)
    #10 0x7fff51bcd963 in FileIDTreeGetCachedPort (CarbonCore:x86_64+0x1963)
    #11 0x7fff51bcd7cf in FSNodeStorageGetAndLockCurrentUniverse (CarbonCore:x86_64+0x17cf)
    #12 0x7fff51bcd659 in FileIDTreeGetAndLockVolumeEntryForDeviceID (CarbonCore:x86_64+0x1659)
    #13 0x7fff51bcd5b6 in FSMount::FSMount(unsigned int, FSMountNumberType, int*, unsigned int const*) (CarbonCore:x86_64+0x15b6)
    #14 0x7fff51bcd530 in FSMountPrepare (CarbonCore:x86_64+0x1530)
    #15 0x7fff64af1a2f in MountInfoPrepare(void***, unsigned int, int, void*, unsigned int const*, __CFURL const*, __CFError**) (CoreServicesInternal:x86_64+0x5a2f)
    #16 0x7fff64af1427 in parseAttributeBuffer(__CFAllocator const*, unsigned char const*, unsigned char, attrlist const*, void const*, void**, _FileAttributes*, unsigned int*) (CoreServicesInternal:x86_64+0x5427)
    #17 0x7fff64af0490 in corePropertyProviderPrepareValues(__CFURL const*, __FileCache*, __CFString const* const*, void const**, long, void const*, __CFError**) (CoreServicesInternal:x86_64+0x4490)
    #18 0x7fff64af00ed in prepareValuesForBitmap(__CFURL const*, __FileCache*, _FilePropertyBitmap*, __CFError**) (CoreServicesInternal:x86_64+0x40ed)
    #19 0x7fff64af3a0e in _FSURLCopyResourcePropertyValuesAndFlags (CoreServicesInternal:x86_64+0x7a0e)
    #20 0x7fff50944bba in _CFURLCopyResourcePropertyValuesAndFlags (CoreFoundation:x86_64h+0x4bbba)
    #21 0x7fff4ee6d245 in FPPathGetCatalogValues(char const*, FInfo*, unsigned long long*, unsigned long long*) (libFontParser.dylib:x86_64+0x51245)
    #22 0x7fff4ee6aed4 in TFont::CreateFontEntities(char const*, bool, bool&, short, char const*, bool) (libFontParser.dylib:x86_64+0x4eed4)
    #23 0x7fff4ee6d659 in TFont::CreateFontEntitiesForFile(char const*, bool, bool, short, char const*) (libFontParser.dylib:x86_64+0x51659)
    #24 0x7fff4ee1d59d in FPFontCreateFontsWithPath (libFontParser.dylib:x86_64+0x159d)
    #25 0x7fff50d4c7d6 in create_private_data_array_with_path (CoreGraphics:x86_64h+0xd7d6)
    #26 0x7fff50d4c4de in CGFontCreateFontsWithPath (CoreGraphics:x86_64h+0xd4de)
    #27 0x7fff50d4c108 in CGFontCreateFontsWithURL (CoreGraphics:x86_64h+0xd108)
    #28 0x7fff5253a432 in CreateFontsWithURL(__CFURL const*, bool) (CoreText:x86_64+0x14432)
    #29 0x7fff5253a1ca in CreateFontWithFontURL(__CFURL const*, bool) (CoreText:x86_64+0x141ca)
```

Leaking the system font. This is probably a false positive:

```
Direct leak of 74 byte(s) in 1 object(s) allocated from:
    #0 0x11c640717 in wrap_realloc (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x59717)
    #1 0x7fff4efdffec in ResizeRawMemory(void*, unsigned int, unsigned char) (libTrueTypeScaler.dylib:x86_64+0xffec)
    #2 0x7fff4eff7b6c in ScalerNewBlock(memoryContext*, int, int, void*, unsigned char, unsigned char, short*) (libTrueTypeScaler.dylib:x86_64+0x27b6c)
    #3 0x7fff4efd2919 in CreateScalerVariationBlock(fsg_SplineKey*, memoryContext*, unsigned int, FontVariation const*) (libTrueTypeScaler.dylib:x86_64+0x2919)
    #4 0x7fff4efe05e2 in AssureStrikeBlocks(fsg_SplineKey*, memoryContext*, cacheStrike*) (libTrueTypeScaler.dylib:x86_64+0x105e2)
    #5 0x7fff4effc8af in TTGetVariationValues (libTrueTypeScaler.dylib:x86_64+0x2c8af)
    #6 0x7fff4ee792d0 in TConcreteFontScaler::GetVariationValues(unsigned long) const (libFontParser.dylib:x86_64+0x5d2d0)
    #7 0x7fff4ee76dc0 in FPFontGetVariationValues (libFontParser.dylib:x86_64+0x5adc0)
    #8 0x7fff52532270 in TFont::InitVariationValues() (CoreText:x86_64+0xc270)
    #9 0x7fff52531515 in TFont::FinishConstruction(CGFont*) (CoreText:x86_64+0xb515)
    #10 0x7fff5252fbf5 in CTFontCreateWithFontDescriptor (CoreText:x86_64+0x9bf5)
    #11 0x7fff775d2f33 in -[__NSSharedFontInstanceInfo _platformFont] (UIFoundation:x86_64+0x4f33)
    #12 0x7fff775d2c12 in -[__NSSharedFontInstanceInfo _textTransform] (UIFoundation:x86_64+0x4c12)
    #13 0x7fff775d2be0 in -[__NSSharedFontInstanceInfo _matrix] (UIFoundation:x86_64+0x4be0)
    #14 0x7fff775d2b5c in -[NSFont initWithInstanceInfo:renderingMode:] (UIFoundation:x86_64+0x4b5c)
    #15 0x7fff775d29b8 in -[__NSSharedFontInstanceInfo fontInstanceForRenderingMode:] (UIFoundation:x86_64+0x49b8)
    #16 0x7fff775d2732 in -[__NSFontTypefaceInfo fontInstanceForFontDescriptor:size:affineTransform:renderingMode:] (UIFoundation:x86_64+0x4732)
    #17 0x7fff775d178f in __NSGetMetaFontInstance (UIFoundation:x86_64+0x378f)
    #18 0x7fff7760089f in +[NSFont systemFontOfSize:] (UIFoundation:x86_64+0x3289f)
    #19 0x112959357 in txt::GetDefaultFontFamily() platform_mac.mm:21
    #20 0x11285f232 in txt::FontCollection::GetMinikinFontCollectionForFamilies(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) font_collection.cc:153
    #21 0x10f059faa in flutter::testing::ShellTest_ReloadSystemFonts_Test::TestBody() shell_unittests.cc:539
    #22 0x1143cf6b2 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2447
    #23 0x11437a4a9 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) gtest.cc:2502
    #24 0x114379ffc in testing::Test::Run() gtest.cc:2522
    #25 0x11437c189 in testing::TestInfo::Run() gtest.cc:2698
    #26 0x11437e779 in testing::TestSuite::Run() gtest.cc:2828
    #27 0x114397521 in testing::internal::UnitTestImpl::RunAllTests() gtest.cc:5285
    #28 0x1143dc7a2 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2447
    #29 0x114396800 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) gtest.cc:2502
```