Skip to content

Commit

Permalink
Merge pull request #607 from jubalh/fixmu
Browse files Browse the repository at this point in the history
Fix bug in LoadMusicStream
  • Loading branch information
raysan5 authored Jul 29, 2018
2 parents 7964b28 + 186c1b1 commit cf021e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit cf021e3

Please sign in to comment.