SDL_mixer: native_midi_common.c (ReadMIDIFile): fix possible NULL ptr dereference. (ed76d)

From ed76d39cda0735d26c14a3e4f4da996e420f6478 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 25 May 2024 23:11:24 +0300
Subject: [PATCH] native_midi_common.c (ReadMIDIFile): fix possible NULL ptr
 dereference.

if allocation of mididata->track ever fails we'd still be dereferencing
it under 'bail'

(cherry picked from commit 9c5ccc06a8701eb593628e4772fa8c32909e301f)
---
 native_midi/native_midi_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/native_midi/native_midi_common.c b/native_midi/native_midi_common.c
index 8b005d79..eee65005 100644
--- a/native_midi/native_midi_common.c
+++ b/native_midi/native_midi_common.c
@@ -280,7 +280,7 @@ static MIDIEvent *MIDItoStream(MIDIFile *mididata)
 
 static int ReadMIDIFile(MIDIFile *mididata, SDL_RWops *rw)
 {
-	int i = 0;
+	int i = -1;
 	Uint32	ID;
 	Uint32	size;
 	Uint16	format;