music_mpg123.c: fix memory leak while playing Frankenstein streams
authorOzkan Sezer
Sun, 22 Dec 2019 15:55:50 +0300
changeset 11145ca667177b34
parent 1113 5a0c021c1f5d
child 1115 760a8cb05f97
music_mpg123.c: fix memory leak while playing Frankenstein streams

Thanks Vitaly Novichkov.
src/codecs/music_mpg123.c
     1.1 --- a/src/codecs/music_mpg123.c	Sun Dec 22 15:55:50 2019 +0300
     1.2 +++ b/src/codecs/music_mpg123.c	Sun Dec 22 15:55:50 2019 +0300
     1.3 @@ -375,6 +375,9 @@
     1.4          format = mpg123_format_to_sdl(encoding);
     1.5          SDL_assert(format != -1);
     1.6  
     1.7 +        if (music->stream) {
     1.8 +            SDL_FreeAudioStream(music->stream);
     1.9 +        }
    1.10          music->stream = SDL_NewAudioStream((SDL_AudioFormat)format, (Uint8)channels, (int)rate,
    1.11                                             music_spec.format, music_spec.channels, music_spec.freq);
    1.12          if (!music->stream) {