How do you free an AudioBufferList?

In the AudioBufferList extension, there is a comment above the allocate function

    /// The memory should be freed with `free()`.
    public static func allocate(maximumBuffers: Int) -> UnsafeMutableAudioBufferListPointer

But when I try to call free on the returned pointer,

free (buffer)

XCode complains:

Cannot convert value of type 'UnsafeMutableAudioBufferListPointer' to expected argument type 'UnsafeMutableRawPointer?'

How should the pointer be free'd?

I tried

free (&buffer)

XCode didn't complain, but when I ran the code, I got an error in the console.

malloc: *** error for object 0x16fdfee70: pointer being freed was not allocated

I know the call to allocate was successful.

Thanks, Mark

Instead of free(&bufferlist), I need to call free(bufferlist.unsafeMutablePointer). Found here.

How do you free an AudioBufferList?
 
 
Q