Fix for memory leak and ref/unref issues with audio input buffer