mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-09 11:26:32 +00:00
Fix bug in LoadMusicStream
free() and NULL at the end.
This commit is contained in:
@@ -1437,9 +1437,6 @@ Music LoadMusicStream(const char *fileName)
|
||||
|
||||
if (!musicLoaded)
|
||||
{
|
||||
free(music);
|
||||
music = NULL;
|
||||
|
||||
if (music->ctxType == MUSIC_AUDIO_OGG) stb_vorbis_close(music->ctxOgg);
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (music->ctxType == MUSIC_AUDIO_FLAC) drflac_free(music->ctxFlac);
|
||||
@@ -1454,6 +1451,9 @@ Music LoadMusicStream(const char *fileName)
|
||||
else if (music->ctxType == MUSIC_MODULE_MOD) jar_mod_unload(&music->ctxMod);
|
||||
#endif
|
||||
|
||||
free(music);
|
||||
music = NULL;
|
||||
|
||||
TraceLog(LOG_WARNING, "[%s] Music file could not be opened", fileName);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user