Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5a093c8e9a30a3953a0230073a8d61b00eece4f2
      
https://github.com/WebKit/WebKit/commit/5a093c8e9a30a3953a0230073a8d61b00eece4f2
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-13 (Sun, 13 Sep 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

  Log Message:
  -----------
  registerFontIfNeeded() leaks the CFErrorRef out-param from 
CTFontManagerRegisterFontsForURL()
https://bugs.webkit.org/show_bug.cgi?id=324088
rdar://187312061

Reviewed by Chris Dumez.

CTFontManagerRegisterFontsForURL()'s error out-parameter follows the
Create rule: on failure it returns a +1-retained CFErrorRef whose
ownership transfers to the caller. registerFontIfNeeded() passed a raw
CFErrorRef, read its description via CFErrorCopyDescription(), but never
released the error itself, leaking one CFError on every failed
registration. Because registration is driven by the fonts the user has
installed, the leak is unbounded.

Adopt the error into a RetainPtr via adoptCF() so it is released when it
goes out of scope. CoreText's CFErrorRef out-parameter is not annotated
CF_RETURNS_RETAINED, so the adopt is annotated SUPPRESS_RETAINPTR_CTOR_ADOPT
to match every other in-tree adoption of an unannotated CFError out-param.
Also rename the shadowing local String from "error" to "errorDescription".

* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::registerFontIfNeeded):

Canonical link: https://commits.webkit.org/321028@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to