File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -459,9 +459,11 @@ MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio)
459
459
460
460
if (rw == NULL )
461
461
return NULL ;
462
-
462
+
463
463
/* Allocate memory for the song */
464
464
song = (MidiSong * )safe_malloc (sizeof (* song ));
465
+ if (song == NULL )
466
+ return NULL ;
465
467
memset (song , 0 , sizeof (* song ));
466
468
467
469
for (i = 0 ; i < MAXBANK ; i ++ )
@@ -498,6 +500,7 @@ MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio)
498
500
song -> encoding |= PE_MONO ;
499
501
else if (audio -> channels > 2 ) {
500
502
SDL_SetError ("Surround sound not supported" );
503
+ free (song );
501
504
return NULL ;
502
505
}
503
506
switch (audio -> format ) {
@@ -530,7 +533,8 @@ MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio)
530
533
break ;
531
534
default :
532
535
SDL_SetError ("Unsupported audio format" );
533
- return NULL ;
536
+ free (song );
537
+ return NULL ;
534
538
}
535
539
536
540
song -> buffer_size = audio -> samples ;
You can’t perform that action at this time.
0 commit comments