diff options
author | David Robillard <d@drobilla.net> | 2020-01-18 17:36:06 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-01-18 17:36:06 +0100 |
commit | 5ae973b8f7f38f32a28b6b23bfe622b51bb64c51 (patch) | |
tree | e0d4a7cfe816ed63c49a95b86396670955461a0a /src/world.c | |
parent | bd0d8e69b753903888faaa781661b422793ef4be (diff) | |
download | lilv-5ae973b8f7f38f32a28b6b23bfe622b51bb64c51.tar.gz lilv-5ae973b8f7f38f32a28b6b23bfe622b51bb64c51.tar.bz2 lilv-5ae973b8f7f38f32a28b6b23bfe622b51bb64c51.zip |
Fix memory leak when dyn-manifest has no plugins
Diffstat (limited to 'src/world.c')
-rw-r--r-- | src/world.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/world.c b/src/world.c index 970111c..22d165a 100644 --- a/src/world.c +++ b/src/world.c @@ -619,7 +619,7 @@ lilv_world_load_dyn_manifest(LilvWorld* world, lilv_world_add_plugin(world, plug, manifest, desc, bundle_node); } if (desc->refs == 0) { - free(desc); + lilv_dynmanifest_free(desc); } sord_iter_free(p); sord_free(plugins); @@ -630,6 +630,23 @@ lilv_world_load_dyn_manifest(LilvWorld* world, #endif // LILV_DYN_MANIFEST } +#ifdef LILV_DYN_MANIFEST +void +lilv_dynmanifest_free(LilvDynManifest* dynmanifest) +{ + typedef int (*CloseFunc)(LV2_Dyn_Manifest_Handle); + CloseFunc close_func = (CloseFunc)lilv_dlfunc(dynmanifest->lib, + "lv2_dyn_manifest_close"); + if (close_func) { + close_func(dynmanifest->handle); + } + + dlclose(dynmanifest->lib); + lilv_node_free(dynmanifest->bundle); + free(dynmanifest); +} +#endif // LILV_DYN_MANIFEST + LilvNode* lilv_world_get_manifest_uri(LilvWorld* world, const LilvNode* bundle_uri) { |