SecCodeCopySigningInformation(kSecCSContentInformation) is leaking 3 objects, totalling 288 Bytes per call when called from bundled executable

Originator:jum
Number:rdar://20936007 Date Originated:13-May-2015 06:08 PM
Status:Open Resolved:
Product:OS X Product Version:10.10.3 (14D136)
Classification:Performance Reproducible:Always
 
Summary:
When called from a bundled executable (e.g. from a Cocoa app), SecCodeCopySigningInformation() will leak 3 objects for each call when the kSecCSContentInformation flag is passed.
I have created a sample project that demonstrates this.

Since we are using this information to verify the integrity of the peer end for IPC communication, this may end up producing quite a noticeable number of leaks over the runtime of our app (which in fact is a bundled launchd job that is always running in the background).


Steps to Reproduce:
Build and run the „yambaapp“ target of the attached sample project. Notice how memory usage goes up.
Now build and profile the „yambaapp“ target -> Instruments will show the continuously growing leaks.
For each call to SecCodeCopySigningInformation(kSecCSContentInformation), an NSArray, a NSURL and a NSCFString object is leaked. All three object together occupy 288 bytes (according to Instruments) for each call to  SecCodeCopySigningInformation(kSecCSContentInformation)

Expected Results:
SecCodeCopySigningInformation(kSecCSContentInformation) should not leak any memory as long as the output dictionary is correctly released.

Actual Results:
Leaks as described above even though the output dictionary is released correctly.

Regression:
The same call, when done from a standalone tool does not leak any memory. Build and run the „yamba“ tool in the attached process to see this.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!