Oops, walk layer list properly to free filenames. Fixes segfault when loading multi-layer kits.

This commit is contained in:
Nick Lanham 2012-02-18 15:50:49 +01:00
parent 2771edd323
commit fd14574c5f

View File

@ -558,9 +558,11 @@ drmr_sample* load_hydrogen_kit(char *path, double rate, int *num_samples) {
if (i_to_free->name) free(i_to_free->name); if (i_to_free->name) free(i_to_free->name);
if (i_to_free->filename) free(i_to_free->filename); if (i_to_free->filename) free(i_to_free->filename);
if (samples[i].layer_count > 0) { if (samples[i].layer_count > 0) {
int j; struct instrument_layer *ltf = i_to_free->layers;
for(j = 0;j < samples[i].layer_count;j++) while (ltf) {
free(i_to_free->layers[j].filename); free(ltf->filename);
ltf = ltf->next;
}
} }
free(i_to_free); free(i_to_free);
i++; i++;