RESOLVED FIXED313364
REGRESSION (304469@main): WTR::supportedAttributes() leaks NSMutableArray
https://bugs.webkit.org/show_bug.cgi?id=313364
Summary REGRESSION (304469@main): WTR::supportedAttributes() leaks NSMutableArray
David Kilzer (:ddkilzer)
Reported 2026-04-26 15:27:27 PDT
`WTR::supportedAttributes()` in `AccessibilityUIElementMac.mm` leaks an `NSMutableArray` on every call. The function assigns the result of `-[NSArray mutableCopy]` directly to a `RetainPtr<NSMutableArray>` without wrapping it in `adoptNS()`. Since `-mutableCopy` returns a +1 (retained) object and `RetainPtr::operator=` retains again, the array ends up at +2. When the `RetainPtr` destructor releases once, the array is left at +1 -- leaked. The leak was introduced in Bug 304071 (304469@main) which changed `supportedAttributes()` from returning a plain `RetainPtr<NSArray>` (assigned from `-accessibilityAttributeNames`, a +0 return) to a `RetainPtr<NSMutableArray>` (assigned from `-mutableCopy`, a +1 return) without adding `adoptNS()`. The leak is visible when running layout tests with `--leaks`. Each call to `supportedAttributes()` leaks one 64-byte `NSMutableArray` plus its 512-byte backing storage.
Attachments
Radar WebKit Bug Importer
Comment 1 2026-04-26 15:27:33 PDT
David Kilzer (:ddkilzer)
Comment 2 2026-04-26 15:34:31 PDT
EWS
Comment 3 2026-04-26 17:20:51 PDT
Committed 312056@main (9323616ae50b): <https://commits.webkit.org/312056@main> Reviewed commits have been landed. Closing PR #63643 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.