Free up scanned kit memory on cleanup. Fixes a memory leak
This commit is contained in:
parent
45b2eeae22
commit
dc17012ed6
1
drmr.c
1
drmr.c
@ -263,6 +263,7 @@ static void cleanup(LV2_Handle instance) {
|
||||
pthread_join(drmr->load_thread, 0);
|
||||
if (drmr->num_samples > 0)
|
||||
free_samples(drmr->samples,drmr->num_samples);
|
||||
free_kits(drmr->kits);
|
||||
free(drmr->gains);
|
||||
free(instance);
|
||||
}
|
||||
|
@ -326,6 +326,17 @@ void free_samples(drmr_sample* samples, int num_samples) {
|
||||
free(samples);
|
||||
}
|
||||
|
||||
void free_kits(kits* kits) {
|
||||
int i;
|
||||
for (i = 0;i < kits->num_kits;i++) {
|
||||
free(kits->kits[i].name);
|
||||
free(kits->kits[i].desc);
|
||||
free(kits->kits[i].path);
|
||||
}
|
||||
free(kits->kits);
|
||||
free(kits);
|
||||
}
|
||||
|
||||
int load_sample(char* path, drmr_layer* layer) {
|
||||
SNDFILE* sndf;
|
||||
int size;
|
||||
|
Loading…
Reference in New Issue
Block a user