Mercurial > SDL_sound_CoreAudio
comparison 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 |
comparison
equal
deleted
inserted
replaced
407:1c7ed7097a9c | 408:3da217bd0e48 |
---|---|
304 name, line)); | 304 name, line)); |
305 return -2; | 305 return -2; |
306 } | 306 } |
307 if (bank->tone[i].name) | 307 if (bank->tone[i].name) |
308 free(bank->tone[i].name); | 308 free(bank->tone[i].name); |
309 { | |
310 printf("alloc name\n"); | |
309 strcpy((bank->tone[i].name=safe_malloc(strlen(w[1])+1)),w[1]); | 311 strcpy((bank->tone[i].name=safe_malloc(strlen(w[1])+1)),w[1]); |
312 } | |
310 bank->tone[i].note=bank->tone[i].amp=bank->tone[i].pan= | 313 bank->tone[i].note=bank->tone[i].amp=bank->tone[i].pan= |
311 bank->tone[i].strip_loop=bank->tone[i].strip_envelope= | 314 bank->tone[i].strip_loop=bank->tone[i].strip_envelope= |
312 bank->tone[i].strip_tail=-1; | 315 bank->tone[i].strip_tail=-1; |
313 | 316 |
314 for (j=2; j<words; j++) | 317 for (j=2; j<words; j++) |
549 free(song); | 552 free(song); |
550 } | 553 } |
551 | 554 |
552 void Timidity_Exit(void) | 555 void Timidity_Exit(void) |
553 { | 556 { |
554 int i; | 557 int i, j; |
555 | 558 |
556 for (i = 0; i < 128; i++) | 559 for (i = 0; i < 128; i++) |
557 { | 560 { |
558 if (master_tonebank[i]) | 561 if (master_tonebank[i]) |
559 { | 562 { |
560 free(master_tonebank[i]->tone); | 563 ToneBankElement *e = master_tonebank[i]->tone; |
564 if (e != NULL) | |
565 { | |
566 for (j = 0; j < 128; j++) | |
567 { | |
568 if (e[j].name != NULL) | |
569 free(e[j].name); | |
570 } | |
571 free(e); | |
572 } | |
561 free(master_tonebank[i]); | 573 free(master_tonebank[i]); |
562 } | 574 } |
563 if (master_drumset[i]) | 575 if (master_drumset[i]) |
564 { | 576 { |
565 free(master_drumset[i]->tone); | 577 free(master_drumset[i]->tone); |