mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-11-10 14:14:53 +00:00
Fix audio memory leaks due to invalid init (thanks Janiszewski!)
SDL_Init(SDL_INIT_AUDIO) did not take into account that functions like
SDL_AddAudioDevice do register events, which will need final cleanup
and only gets fired when events were actually initialised.
Sample call stack of a malloc missing its free (Linux + PA):
SDL_malloc_REAL (SDL_malloc.c:5328)
SDL_AddEvent (SDL_events.c:445)
SDL_PeepEvents_REAL (SDL_events.c:531)
SDL_PushEvent_REAL (SDL_events.c:762)
SDL_AddAudioDevice (SDL_audio.c:443)
SourceInfoCallback (SDL_pulseaudio.c:681)
context_get_source_info_callback (introspect.c:534)
run_action (pdispatch.c:288)
pa_pdispatch_run (pdispatch.c:341)
pstream_packet_callback (context.c:349)
do_read (pstream.c:1012)
Fixes https://github.com/libsdl-org/SDL/issues/3005
This commit is contained in:
parent
71e3998d6c
commit
c31a40246d
|
|
@ -169,8 +169,8 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
flags |= SDL_INIT_JOYSTICK;
|
||||
}
|
||||
|
||||
if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK))) {
|
||||
/* video or joystick implies events */
|
||||
if ((flags & (SDL_INIT_VIDEO|SDL_INIT_JOYSTICK|SDL_INIT_AUDIO))) {
|
||||
/* video or joystick or audio implies events */
|
||||
flags |= SDL_INIT_EVENTS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue