Mercurial > SDL_sound_CoreAudio
diff decoders/timidity/timidity.c @ 408:3da217bd0e48
Memory leak fixes.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 29 Jul 2002 07:50:29 +0000 |
parents | a73c51c12452 |
children | 1ba14a084531 |
line wrap: on
line diff
--- a/decoders/timidity/timidity.c Sun Jul 21 15:18:49 2002 +0000 +++ b/decoders/timidity/timidity.c Mon Jul 29 07:50:29 2002 +0000 @@ -306,7 +306,10 @@ } if (bank->tone[i].name) free(bank->tone[i].name); +{ +printf("alloc name\n"); strcpy((bank->tone[i].name=safe_malloc(strlen(w[1])+1)),w[1]); +} bank->tone[i].note=bank->tone[i].amp=bank->tone[i].pan= bank->tone[i].strip_loop=bank->tone[i].strip_envelope= bank->tone[i].strip_tail=-1; @@ -551,13 +554,22 @@ void Timidity_Exit(void) { - int i; + int i, j; for (i = 0; i < 128; i++) { if (master_tonebank[i]) { - free(master_tonebank[i]->tone); + ToneBankElement *e = master_tonebank[i]->tone; + if (e != NULL) + { + for (j = 0; j < 128; j++) + { + if (e[j].name != NULL) + free(e[j].name); + } + free(e); + } free(master_tonebank[i]); } if (master_drumset[i])