filter-chain: free descriptor

Fixes #2220
This commit is contained in:
Wim Taymans 2022-04-01 10:10:22 +02:00
parent da10a2ad60
commit f9e8e689d3
4 changed files with 6 additions and 4 deletions

View file

@ -816,6 +816,8 @@ static void descriptor_unref(struct descriptor *desc)
spa_list_remove(&desc->link);
plugin_unref(desc->plugin);
if (desc->desc)
fc_descriptor_free(desc->desc);
free(desc->input);
free(desc->output);
free(desc->control);

View file

@ -136,7 +136,7 @@ static void ladspa_port_update_ranges(struct descriptor *dd, struct fc_port *por
port->max = upper;
}
static void ladspa_free(struct fc_descriptor *desc)
static void ladspa_free(const struct fc_descriptor *desc)
{
struct descriptor *d = (struct descriptor*)desc;
free(d->desc.ports);

View file

@ -380,7 +380,7 @@ static void lv2_run(void *instance, unsigned long SampleCount)
i->work_iface->end_run(i->instance);
}
static void lv2_free(struct fc_descriptor *desc)
static void lv2_free(const struct fc_descriptor *desc)
{
struct descriptor *d = (struct descriptor*)desc;
free((char*)d->desc.name);

View file

@ -66,7 +66,7 @@ struct fc_descriptor {
#define FC_DESCRIPTOR_SUPPORTS_NULL_DATA (1ULL << 0)
uint64_t flags;
void (*free) (struct fc_descriptor *desc);
void (*free) (const struct fc_descriptor *desc);
uint32_t n_ports;
struct fc_port *ports;
@ -90,7 +90,7 @@ static inline void fc_plugin_free(struct fc_plugin *plugin)
plugin->unload(plugin);
}
static inline void fc_descriptor_free(struct fc_descriptor *desc)
static inline void fc_descriptor_free(const struct fc_descriptor *desc)
{
if (desc->free)
desc->free(desc);