Hi Experts,
I created a simple application with the following code to retrieve the signing info from Apps such as Xcode:
CFURLRef appURLRef = NULL;
SecStaticCodeRef staticCodeRef = NULL;
CFDictionaryRef signatureInfoRef = NULL;
do {
appURLRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR("/Applications/Xcode.app"), kCFURLPOSIXPathStyle, YES);
if(!appURLRef) {
break;
}
OSStatus status = SecStaticCodeCreateWithPath(appURLRef, kSecCSDefaultFlags, &staticCodeRef);
if(errSecSuccess != status) {
break;
}
status = SecCodeCopySigningInformation(staticCodeRef, kSecCSSigningInformation, &signatureInfoRef);
if(errSecSuccess != status) {
break;
}
} while(0);
if(staticCodeRef) {
CFRelease(staticCodeRef);
staticCodeRef = NULL;
}
if(signatureInfoRef) {
CFRelease(signatureInfoRef);
signatureInfoRef = NULL;
}
if(appURLRef) {
CFRelease(appURLRef);
appURLRef = NULL;
}
then I use leaks to check if any memory issues, the output is:
Process: checksig [4733]
Path: /Users/USER/Library/Developer/Xcode/DerivedData/Build/Products/Debug/checksig
Load Address: 0x10e033000
Identifier: checksig
Version: ???
Code Type: X86-64
Platform: macOS
Parent Process: leaks [4732]
Date/Time: 2022-02-13 23:10:32.606 +0800
Launch Time: 2022-02-13 23:10:32.109 +0800
OS Version: Mac OS X 10.15.6 (19G73)
Report Version: 7
Analysis Tool: /Applications/Xcode.app/Contents/Developer/usr/bin/leaks
Analysis Tool Version: Xcode 12.4 (12D4e)
----
leaks Report Version: 4.0
Process 4733: 3725 nodes malloced for 456 KB
Process 4733: 1 leak for 32 total leaked bytes.
1 (32 bytes) ROOT LEAK: 0x7ffc33d04c00 [32] length: 23 ",CSSMERR_CL_UNKNOWN_TAG"
If I remove the SecCodeCopySigningInformation line, then the issue is gone.
So there is a memory leak in API SecCodeCopySigningInformation? or in my code or sth incorrect in the report of leaks? Did anybody see the same issue before? thanks a lot!