ViennaRSS / vienna-rss

Vienna is a free and open-source RSS/Atom newsreader for macOS.
https://www.vienna-rss.com
Apache License 2.0
1.85k stars 227 forks source link

Resolve possible memory leaks in Keychain functions #1706

Closed Eitot closed 1 year ago

Eitot commented 1 year ago

CoreFoundation API do not use ARC. The SecItemCopyMatching(,) function returns an owning reference to the CFTypeRef it passes back. By using __bridge_transfer instead of __bridge, the pointer is bridged to an Objective-C object and then its memory is managed by ARC.

Local variable pointers to CoreFoundation objects do not appear to be set to NULL by default, unlike Objective-C pointers when ARC is enabled. As a precaution, the initial value of those variables is set to NULL.

See: