[NTGDI] FontLink: avoid invalid font name buffer freeing (#7131)

Don't free the linked font name if it's already NULL. Since it is allocated only once (when loading the font name from Registry), it should be freed only once too. All subsequent freeing attempts will result in invalid pool freeing.
This fixes the 0xC2 BAD_POOL_CALLER bugcheck when trying to resize window (and draw more text) from soundcloud.com in K-Meleon 76.5.4 Goanna engine and when switching between channels (during redrawing the text) in DiscordMessenger v1.06 Beta.
Addendum to 0f9e889736.
CORE-19681
This commit is contained in:
Oleg Dubinskiy 2024-07-11 14:27:26 +02:00 committed by GitHub
parent 9e07d0cc74
commit 04f04efc96
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -220,7 +220,8 @@ FontLink_Chain_Free(
if (!FontLink_Chain_IsPopulated(pChain)) // The chain is not populated yet
return;
ExFreePoolWithTag(pChain->pszzFontLink, TAG_FONT);
if (pChain->pszzFontLink)
ExFreePoolWithTag(pChain->pszzFontLink, TAG_FONT);
while (!IsListEmpty(&pChain->FontLinkList))
{