Navigation Menu

Skip to content

Commit

Permalink
Fixed bug 3072 - Memory leak in SDL_mixer in native_midi_common.c in …
Browse files Browse the repository at this point in the history
…function MIDItoStream

Amit Jain

Memory leak in SDL_mixer-2.0.0 in native_midi_common.c in function MIDItoStream().

return without deletion of allocated memory.

static MIDIEvent *MIDItoStream(MIDIFile *mididata)
{
   ...
   ...
   ...
    track = (MIDIEvent**) calloc(1, sizeof(MIDIEvent*) * mididata->nTracks);

    if (NULL == track)
        return NULL;

 ...
 ...
 ...

}
  • Loading branch information
slouken committed Oct 13, 2017
1 parent f8bd0f8 commit bd239ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion native_midi/native_midi_common.c
Expand Up @@ -230,9 +230,11 @@ static MIDIEvent *MIDItoStream(MIDIFile *mididata)
return NULL;

track = (MIDIEvent**) calloc(1, sizeof(MIDIEvent*) * mididata->nTracks);

if (NULL == track)
{
free(head);
return NULL;
}

/* First, convert all tracks to MIDIEvent lists */
for (trackID = 0; trackID < mididata->nTracks; trackID++)
Expand Down

0 comments on commit bd239ae

Please sign in to comment.