Skip to content

Commit

Permalink
Remove CFRelease() calls in host_get_name() (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
directmusic authored Sep 8, 2024
1 parent c4167b8 commit 90b16c5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/detail/auv2/auv2_base_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,19 @@ class WrapAsAUV2 : public ausdk::AUBase,
const char* host_get_name() override
{
char text[65];
// No need to release any of these "Get" functions.
// https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-SW1

CFBundleRef applicationBundle = CFBundleGetMainBundle();
if (applicationBundle != NULL)
{
CFStringRef myProductString =
(CFStringRef)CFBundleGetValueForInfoDictionaryKey(applicationBundle, kCFBundleNameKey);

if (myProductString)
{
CFStringGetCString(myProductString, text, 64, kCFStringEncodingUTF8);
_hostname = text;
CFRelease(myProductString);
}
else
{
Expand All @@ -445,10 +447,8 @@ class WrapAsAUV2 : public ausdk::AUBase,
{
CFStringGetCString(applicationBundleID, text, 64, kCFStringEncodingUTF8);
_hostname = text;
CFRelease(applicationBundleID);
}
}
// CFRelease(applicationBundle); Don't release it
CFStringRef myVersionString =
(CFStringRef)CFBundleGetValueForInfoDictionaryKey(applicationBundle, kCFBundleVersionKey);
if (myVersionString)
Expand All @@ -457,7 +457,6 @@ class WrapAsAUV2 : public ausdk::AUBase,
_hostname.append(" (");
_hostname.append(text);
_hostname.append(")");
CFRelease(myVersionString);
}
_hostname.append(" (CLAP-as-AUv2)");
}
Expand Down

0 comments on commit 90b16c5

Please sign in to comment.