OSX: Fix memory leaks