# HG changeset patch # User Ryan C. Gordon # Date 1027929029 0 # Node ID 3da217bd0e482008d77b830662d8692fca696625 # Parent 1c7ed7097a9ce0e68624391caf8505fc96a19887 Memory leak fixes. diff -r 1c7ed7097a9c -r 3da217bd0e48 decoders/timidity/common.c --- a/decoders/timidity/common.c Sun Jul 21 15:18:49 2002 +0000 +++ b/decoders/timidity/common.c Mon Jul 29 07:50:29 2002 +0000 @@ -111,8 +111,11 @@ plp->path = safe_malloc(strlen(s) + 1); if (plp->path == NULL) + { + free(plp); return; - + } + strcpy(plp->path, s); plp->next = pathlist; pathlist = plp; @@ -126,6 +129,7 @@ while (plp) { next = plp->next; + free(plp->path); free(plp); plp = next; } diff -r 1c7ed7097a9c -r 3da217bd0e48 decoders/timidity/timidity.c --- 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])