Memory Leak: JuceAU::SaveState & Ableton Live 8 (Latest JUCE tip)

Hey Jules,

I have discovered amemory leak with the latest JUCE tip inside of which only seems to be triggered in Ableton Live 8. Further more, this memory leak was not present in any version of Logic or AU Lab (both 32-bit and 64-bit -- tested w/ Logic Pro 9 and Logic Pro X) and the VST wrapper seemed to handle as expected.

Anyways, I am using Mountain Lion 10.8.5 12F37 with Xcode 4.6.3 (4H1503) and I have setup the build configuration with MacOSX 10.8 as the base SDK and GNU++98 as the dialect.

One more thing to note, is that there are no issues with the VST wrapper in the same version of Ableton Live 8.4.1

From Apple Instruments, here is the call stack as recorded by the leak detector:

   0 CoreFoundation __CFAllocatorSystemAllocate
   1 CoreFoundation CFAllocatorAllocate
   2 CoreFoundation _CFRuntimeCreateInstance
   3 CoreFoundation __CFDataInit
   4 CoreFoundation CFDataCreate
   5 AudioUnitProject JuceAU::SaveState(void const**) /Users/joeburnett/AudioUnitProject/Builds/MacOSX/../../JuceLibraryCode/modules/juce_audio_plugin_client/AU/
   6 AudioUnitProject AUBase::DispatchGetProperty(unsigned long, unsigned long, unsigned long, void*) /Applications/
   7 AudioUnitProject AUBase::ComponentEntryDispatch(ComponentParameters*, AUBase*) /Applications/
   8 AudioUnitProject AUMIDIEffectBase::ComponentEntryDispatch(ComponentParameters*, AUMIDIEffectBase*) /Applications/
   9 AudioUnitProject ComponentEntryPoint<JuceAU>::Dispatch(ComponentParameters*, JuceAU*) /Applications/
  10 AudioUnitProject AudioUnitProjectAUEntry /Users/joeburnett/AudioUnitProject/Builds/MacOSX/../../JuceLibraryCode/modules/juce_audio_plugin_client/AU/
  11 CarbonCore CallComponent
  12 CarbonCore CallComponentDispatch
  13 AudioToolbox _AT_AudioUnitGetProperty


If you look at the juce code, you can see that it does correctly release that CFData block - it's the host that's doing the leaking there, not the plugin.