We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4573

Summary: macOS MIDI: memory leak when freeing song
Product: SDL_mixer Reporter: ioanch <ioan.chera>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sezeroz
Version: 2.0.4   
Hardware: x86_64   
OS: macOS 10.13   

Description ioanch 2019-03-30 14:11:03 UTC
I've discovered a memory leak when using MIDI music on macOS (I'm on Mojave).

When freeing a song, DisposeMusicSequence returns error "kAudioToolboxErr_CannotDoInCurrentContext" (-10863, https://www.osstatus.com/search/results?platform=all&framework=all&search=-10863 ), unless you call "MusicPlayerSetSequence(song->player, NULL);" before it.

See my fix I did on my fork of SDL2_mixer here: https://bitbucket.org/ichera/sdl_mixer/commits/713acbd976efd31c441e37906d76b7fa790572dd?at=macos-music-leak-fix
Comment 1 Ozkan Sezer 2019-04-04 09:39:04 UTC
Ryan, is this patch correct?
Comment 2 Ozkan Sezer 2019-07-03 08:32:13 UTC
Ryan:  Should we apply this?
Comment 3 Sam Lantinga 2019-07-03 09:32:16 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL_mixer/rev/1c557e8ac98f