Oops, walk layer list properly to free filenames. Fixes segfault when loading multi-layer kits.
This commit is contained in:
parent
2771edd323
commit
fd14574c5f
@ -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++;
|
||||||
|
Loading…
Reference in New Issue
Block a user