diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/instance.c | 7 | ||||
-rw-r--r-- | src/lib.c | 6 | ||||
-rw-r--r-- | src/util.c | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/instance.c b/src/instance.c index a3e2c91..ef64405 100644 --- a/src/instance.c +++ b/src/instance.c @@ -33,11 +33,12 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, const LilvNode* const lib_uri = lilv_plugin_get_library_uri(plugin); const LilvNode* const bundle_uri = lilv_plugin_get_bundle_uri(plugin); - const char* bundle_path = lilv_uri_to_path( - lilv_node_as_uri(lilv_plugin_get_bundle_uri(plugin))); + char* const bundle_path = lilv_file_uri_parse( + lilv_node_as_uri(lilv_plugin_get_bundle_uri(plugin)), NULL); LilvLib* lib = lilv_lib_open(plugin->world, lib_uri, bundle_path, features); if (!lib) { + free(bundle_path); return NULL; } @@ -46,6 +47,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, SerdURI base_uri; if (serd_uri_parse((const uint8_t*)bundle_uri_str, &base_uri)) { lilv_lib_close(lib); + free(bundle_path); return NULL; } @@ -93,6 +95,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, } free(local_features); + free(bundle_path); if (result) { // Failed to instantiate @@ -33,7 +33,7 @@ lilv_lib_open(LilvWorld* world, } const char* const lib_uri = lilv_node_as_uri(uri); - const char* const lib_path = lilv_uri_to_path(lib_uri); + char* const lib_path = lilv_file_uri_parse(lib_uri, NULL); if (!lib_path) { return NULL; } @@ -42,6 +42,7 @@ lilv_lib_open(LilvWorld* world, void* lib = dlopen(lib_path, RTLD_NOW); if (!lib) { LILV_ERRORF("Failed to open library %s (%s)\n", lib_path, dlerror()); + free(lib_path); return NULL; } @@ -56,14 +57,17 @@ lilv_lib_open(LilvWorld* world, desc = ldf(bundle_path, features); if (!desc) { LILV_ERRORF("Call to `lv2_lib_descriptor' in %s failed\n", lib_path); + free(lib_path); return NULL; } } else if (!df) { LILV_ERRORF("No `lv2_descriptor' or `lv2_lib_descriptor' in %s\n", lib_path); dlclose(lib); + free(lib_path); return NULL; } + free(lib_path); LilvLib* llib = (LilvLib*)malloc(sizeof(LilvLib)); llib->world = world; @@ -118,6 +118,12 @@ lilv_uri_to_path(const char* uri) return (const char*)serd_uri_to_path((const uint8_t*)uri); } +char* +lilv_file_uri_parse(const char* uri, char** hostname) +{ + return (char*)serd_file_uri_parse((const uint8_t*)uri, (uint8_t**)hostname); +} + /** Return the current LANG converted to Turtle (i.e. RFC3066) style. * For example, if LANG is set to "en_CA.utf-8", this returns "en-ca". */ |