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);
|
pthread_join(drmr->load_thread, 0);
|
||||||
if (drmr->num_samples > 0)
|
if (drmr->num_samples > 0)
|
||||||
free_samples(drmr->samples,drmr->num_samples);
|
free_samples(drmr->samples,drmr->num_samples);
|
||||||
|
free_kits(drmr->kits);
|
||||||
free(drmr->gains);
|
free(drmr->gains);
|
||||||
free(instance);
|
free(instance);
|
||||||
}
|
}
|
||||||
|
@ -326,6 +326,17 @@ void free_samples(drmr_sample* samples, int num_samples) {
|
|||||||
free(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) {
|
int load_sample(char* path, drmr_layer* layer) {
|
||||||
SNDFILE* sndf;
|
SNDFILE* sndf;
|
||||||
int size;
|
int size;
|
||||||
|
@ -214,6 +214,7 @@ static void cleanup(LV2UI_Handle handle) {
|
|||||||
gtk_widget_destroy(ui->drmr_widget);
|
gtk_widget_destroy(ui->drmr_widget);
|
||||||
if (ui->gain_sliders) free(ui->gain_sliders);
|
if (ui->gain_sliders) free(ui->gain_sliders);
|
||||||
if (ui->pan_sliders) free(ui->pan_sliders);
|
if (ui->pan_sliders) free(ui->pan_sliders);
|
||||||
|
free_kits(ui->kits);
|
||||||
free(ui);
|
free(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user