Fix memory leaks in LADSPA plugins
This commit is contained in:
@@ -567,6 +567,22 @@ lookahead_limiter::lookahead_limiter() {
|
||||
asc_coeff = 1.f;
|
||||
}
|
||||
|
||||
lookahead_limiter::~lookahead_limiter()
|
||||
{
|
||||
if( buffer != NULL)
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
if( nextpos != NULL)
|
||||
{
|
||||
free(nextpos);
|
||||
}
|
||||
if( nextdelta != NULL)
|
||||
{
|
||||
free(nextdelta);
|
||||
}
|
||||
}
|
||||
|
||||
void lookahead_limiter::activate()
|
||||
{
|
||||
is_active = true;
|
||||
|
||||
@@ -608,6 +608,7 @@ public:
|
||||
void reset_asc();
|
||||
bool get_asc();
|
||||
lookahead_limiter();
|
||||
~lookahead_limiter();
|
||||
void set_multi(bool set);
|
||||
void process(float &left, float &right, float *multi_buffer);
|
||||
void set_sample_rate(uint32_t sr);
|
||||
|
||||
@@ -47,6 +47,7 @@ struct ladspa_instance: public plugin_ctl_iface
|
||||
#endif
|
||||
|
||||
ladspa_instance(audio_module_iface *_module, ladspa_plugin_metadata_set *_ladspa, int sample_rate);
|
||||
virtual ~ladspa_instance();
|
||||
virtual const line_graph_iface *get_line_graph_iface() const { return module->get_line_graph_iface(); }
|
||||
virtual float get_param_value(int param_no);
|
||||
virtual void set_param_value(int param_no, float value);
|
||||
|
||||
@@ -263,6 +263,7 @@ class mono_audio_module:
|
||||
}
|
||||
public:
|
||||
mono_audio_module();
|
||||
~mono_audio_module();
|
||||
void params_changed();
|
||||
void activate();
|
||||
void set_sample_rate(uint32_t sr);
|
||||
@@ -291,6 +292,7 @@ class stereo_audio_module:
|
||||
}
|
||||
public:
|
||||
stereo_audio_module();
|
||||
~stereo_audio_module();
|
||||
void params_changed();
|
||||
void activate();
|
||||
void set_sample_rate(uint32_t sr);
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
uint32_t srate;
|
||||
bool is_active;
|
||||
multibandlimiter_audio_module();
|
||||
~multibandlimiter_audio_module();
|
||||
void activate();
|
||||
void deactivate();
|
||||
void params_changed();
|
||||
|
||||
@@ -460,6 +460,14 @@ stereo_audio_module::stereo_audio_module() {
|
||||
meter_outR = 0.f;
|
||||
}
|
||||
|
||||
stereo_audio_module::~stereo_audio_module()
|
||||
{
|
||||
if( buffer != NULL )
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void stereo_audio_module::activate() {
|
||||
active = true;
|
||||
}
|
||||
@@ -686,6 +694,14 @@ mono_audio_module::mono_audio_module() {
|
||||
meter_outR = 0.f;
|
||||
}
|
||||
|
||||
mono_audio_module::~mono_audio_module()
|
||||
{
|
||||
if( buffer != NULL )
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void mono_audio_module::activate() {
|
||||
active = true;
|
||||
}
|
||||
|
||||
@@ -252,6 +252,14 @@ multibandlimiter_audio_module::multibandlimiter_audio_module()
|
||||
asc_old = true;
|
||||
}
|
||||
|
||||
multibandlimiter_audio_module::~multibandlimiter_audio_module()
|
||||
{
|
||||
if( buffer != NULL)
|
||||
{
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void multibandlimiter_audio_module::activate()
|
||||
{
|
||||
is_active = true;
|
||||
|
||||
@@ -54,6 +54,11 @@ ladspa_instance::ladspa_instance(audio_module_iface *_module, ladspa_plugin_meta
|
||||
module->post_instantiate();
|
||||
}
|
||||
|
||||
ladspa_instance::~ladspa_instance()
|
||||
{
|
||||
delete module;
|
||||
}
|
||||
|
||||
float ladspa_instance::get_param_value(int param_no)
|
||||
{
|
||||
// XXXKF hack
|
||||
|
||||
@@ -116,6 +116,8 @@ static void activateDj_eq_mono(LADSPA_Handle instance) {
|
||||
}
|
||||
|
||||
static void cleanupDj_eq_mono(LADSPA_Handle instance) {
|
||||
Dj_eq_mono *plugin_data = (Dj_eq_mono *)instance;
|
||||
free(plugin_data->filters);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
@@ -283,6 +285,8 @@ static void activateDj_eq(LADSPA_Handle instance) {
|
||||
}
|
||||
|
||||
static void cleanupDj_eq(LADSPA_Handle instance) {
|
||||
Dj_eq *plugin_data = (Dj_eq *)instance;
|
||||
free(plugin_data->filters);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ static void cleanupFastLookaheadLimiter(LADSPA_Handle instance) {
|
||||
#line 188 "fast_lookahead_limiter_1913.xml"
|
||||
FastLookaheadLimiter *plugin_data = (FastLookaheadLimiter *)instance;
|
||||
free(plugin_data->buffer);
|
||||
free(plugin_data->chunks);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,11 @@ static void cleanupImp(LADSPA_Handle instance) {
|
||||
local_free(plugin_data->op);
|
||||
local_free(plugin_data->overlap);
|
||||
local_free(plugin_data->opc);
|
||||
unsigned int i;
|
||||
for (i=0; i<IMPULSES; i++) {
|
||||
local_free(plugin_data->impulse_freq[i]);
|
||||
}
|
||||
local_free(plugin_data->impulse_freq);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ static void cleanupVynil(LADSPA_Handle instance) {
|
||||
free(plugin_data->buffer_m);
|
||||
free(plugin_data->buffer_s);
|
||||
free(plugin_data->click_buffer);
|
||||
free(plugin_data->highp);
|
||||
free(plugin_data->lowp_m);
|
||||
free(plugin_data->lowp_s);
|
||||
free(plugin_data->noise_filt);
|
||||
|
||||
@@ -145,7 +145,8 @@ activate_eq(LADSPA_Handle instance) {
|
||||
static
|
||||
void
|
||||
cleanup_eq(LADSPA_Handle instance) {
|
||||
|
||||
eq *plugin_data = (eq *)instance;
|
||||
free(plugin_data->filters);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,8 @@ activate_eq(LADSPA_Handle instance) {
|
||||
static
|
||||
void
|
||||
cleanup_eq(LADSPA_Handle instance) {
|
||||
|
||||
eq *plugin_data = (eq *)instance;
|
||||
free(plugin_data->filters);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user