mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-02 17:09:26 +02:00
Fix LV2 memory leaks
This commit is contained in:
parent
c9a8eb0771
commit
15dcb343f3
@ -713,7 +713,12 @@ bool LV2Effect::SetHost(EffectHostInterface *host)
|
|||||||
if (unit)
|
if (unit)
|
||||||
{
|
{
|
||||||
// Really should use lilv_world_get_symbol()
|
// Really should use lilv_world_get_symbol()
|
||||||
controlPort->mUnits = LilvString(lilv_world_get_symbol(gWorld, unit));
|
LilvNode *symbol = lilv_world_get_symbol(gWorld, unit);
|
||||||
|
if (symbol)
|
||||||
|
{
|
||||||
|
controlPort->mUnits = LilvString(symbol);
|
||||||
|
lilv_node_free(symbol);
|
||||||
|
}
|
||||||
lilv_node_free(unit);
|
lilv_node_free(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2176,21 +2181,27 @@ bool LV2Effect::BuildFancy()
|
|||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
// Plugins may have dependencies that need to be loaded from the same path
|
// Plugins may have dependencies that need to be loaded from the same path
|
||||||
// as the main DLL, so add this plugin's path to the DLL search order.
|
// as the main DLL, so add this plugin's path to the DLL search order.
|
||||||
const char *const libPath = lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui)));
|
char *libPath = lilv_file_uri_parse(lilv_node_as_uri(lilv_ui_get_binary_uri(ui)), NULL);
|
||||||
wxString path = wxPathOnly(libPath);
|
wxString path = wxPathOnly(libPath);
|
||||||
SetDllDirectory(path.c_str());
|
SetDllDirectory(path.c_str());
|
||||||
|
lilv_free(libPath);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char *bundlePath = lilv_file_uri_parse(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui)), NULL);
|
||||||
|
char *binaryPath = lilv_file_uri_parse(lilv_node_as_uri(lilv_ui_get_binary_uri(ui)), NULL);
|
||||||
|
|
||||||
mSuilInstance = suil_instance_new(mSuilHost,
|
mSuilInstance = suil_instance_new(mSuilHost,
|
||||||
this,
|
this,
|
||||||
containerType,
|
containerType,
|
||||||
lilv_node_as_uri(lilv_plugin_get_uri(mPlug)),
|
lilv_node_as_uri(lilv_plugin_get_uri(mPlug)),
|
||||||
lilv_node_as_uri(lilv_ui_get_uri(ui)),
|
lilv_node_as_uri(lilv_ui_get_uri(ui)),
|
||||||
lilv_node_as_uri(uiType),
|
lilv_node_as_uri(uiType),
|
||||||
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_bundle_uri(ui))),
|
bundlePath,
|
||||||
lilv_uri_to_path(lilv_node_as_uri(lilv_ui_get_binary_uri(ui))),
|
binaryPath,
|
||||||
reinterpret_cast<const LV2_Feature * const *>(mFeatures.data()));
|
reinterpret_cast<const LV2_Feature * const *>(mFeatures.data()));
|
||||||
|
|
||||||
|
lilv_free(binaryPath);
|
||||||
|
lilv_free(bundlePath);
|
||||||
lilv_uis_free(uis);
|
lilv_uis_free(uis);
|
||||||
|
|
||||||
// Bail if the instance (no compatible UI) couldn't be created
|
// Bail if the instance (no compatible UI) couldn't be created
|
||||||
@ -3324,9 +3335,10 @@ LilvInstance *LV2Wrapper::Instantiate(const LilvPlugin *plugin,
|
|||||||
// as the main DLL, so add this plugin's path to the DLL search order.
|
// as the main DLL, so add this plugin's path to the DLL search order.
|
||||||
const LilvNode *const libNode = lilv_plugin_get_library_uri(plugin);
|
const LilvNode *const libNode = lilv_plugin_get_library_uri(plugin);
|
||||||
const char *const libUri = lilv_node_as_uri(libNode);
|
const char *const libUri = lilv_node_as_uri(libNode);
|
||||||
const char *const libPath = lilv_uri_to_path(libUri);
|
char *libPath = lilv_file_uri_parse(libUri, NULL);
|
||||||
wxString path = wxPathOnly(libPath);
|
wxString path = wxPathOnly(libPath);
|
||||||
SetDllDirectory(path.c_str());
|
SetDllDirectory(path.c_str());
|
||||||
|
lilv_free(libPath);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mInstance = lilv_plugin_instantiate(plugin,
|
mInstance = lilv_plugin_instantiate(plugin,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user