Skip to content

Commit

Permalink
Fix possible double free call
Browse files Browse the repository at this point in the history
This fix prevents program from crashing when calling WildMidi_Init() -> WildMidi_Shutdown() several times.
  • Loading branch information
trialuser02 authored and sezero committed Nov 28, 2024
1 parent 233defd commit 67b0c9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/wildmidi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,10 @@ WM_SYMBOL int WildMidi_Shutdown(void) {

WM_Initialized = 0;

if (_WM_Global_ErrorS != NULL) free(_WM_Global_ErrorS);
if (_WM_Global_ErrorS != NULL) {
free(_WM_Global_ErrorS);
_WM_Global_ErrorS = NULL;
}

_WM_BufferFile = _WM_BufferFileImpl;
_WM_FreeBufferFile = _WM_FreeBufferFileImpl;
Expand Down

0 comments on commit 67b0c9a

Please sign in to comment.