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

From 9c5ccc06a8701eb593628e4772fa8c32909e301f Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 25 May 2024 23:11:10 +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'
---
 src/codecs/native_midi/native_midi_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/codecs/native_midi/native_midi_common.c b/src/codecs/native_midi/native_midi_common.c
index d9abd664..e84f3158 100644
--- a/src/codecs/native_midi/native_midi_common.c
+++ b/src/codecs/native_midi/native_midi_common.c
@@ -260,7 +260,7 @@ static MIDIEvent *MIDItoStream(MIDIFile *mididata)
 
 static int ReadMIDIFile(MIDIFile *mididata, SDL_IOStream *src)
 {
-    int i = 0;
+    int i = -1;
     Uint32 ID = 0;
     Uint32 size = 0;
     Uint16 format = 0;