Patch for Mac OS X again

It's long time that after previous commit.

This commit mainly fix the memory leak when playing sound.