AudioUnit Hosting Memory Leak

Tracked down a memory leak that is still in Juce 8(I’m currently on 6).

AudioUnitPluginFormat.mm (link to line) getText function.

Calls AudioUnitGetProperty with kAudioUnitProperty_ParameterStringFromValue, this stringValue.outString should be released(it currently isn’t).

From AudioUnitProperties.h

kAudioUnitProperty_ParameterStringFromValue
						Scope:				any
						Value Type:			AudioUnitParameterStringFromValue
						Access:				read

						 <snip>
						
						**On exit, the outName may point to a CFStringRef (which if so must be released by the caller).**
						

For me this fixed it…

if (! err && stringValue.outString != nullptr)
					{
						CFObjectHolder<CFStringRef> cfName(stringValue.outString);
						return String::fromCFString (stringValue.outString).substring (0, maximumLength);
						}

There may be other’s like getProgramName and the call with kAudioUnitProperty_ParameterClumpName which require the same treatment.

kind regards
Justin

1 Like

Thanks for reporting these issues. A fix has been added on the develop branch: