From 6b289101e425d58c085a4c905bbcd6da211818a8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 15 Mar 2011 01:42:54 +0000 Subject: Fix dynamic manifest error handling. Close dynamic manifest libraries after discovery. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3084 a436a847-0d15-0410-975c-d299462d15a1 --- src/world.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/world.c b/src/world.c index df97e7a..9983ded 100644 --- a/src/world.c +++ b/src/world.c @@ -395,15 +395,21 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) // Open dynamic manifest typedef int (*OpenFunc)(LV2_Dyn_Manifest_Handle*, const LV2_Feature *const *); OpenFunc open_func = (OpenFunc)slv2_dlfunc(lib, "lv2_dyn_manifest_open"); - if (open_func) - open_func(&handle, &dman_features); + if (!open_func || open_func(&handle, &dman_features)) { + SLV2_ERRORF("Missing lv2_dyn_manifest_open in `%s'\n", lib_path); + dlclose(lib); + continue; + } // Get subjects (the data that would be in manifest.ttl) typedef int (*GetSubjectsFunc)(LV2_Dyn_Manifest_Handle, FILE*); - GetSubjectsFunc get_subjects_func = (GetSubjectsFunc)slv2_dlfunc(lib, - "lv2_dyn_manifest_get_subjects"); - if (!get_subjects_func) + GetSubjectsFunc get_subjects_func = (GetSubjectsFunc)slv2_dlfunc( + lib, "lv2_dyn_manifest_get_subjects"); + if (!get_subjects_func) { + SLV2_ERRORF("Missing lv2_dyn_manifest_get_subjects in `%s'\n", lib_path); + dlclose(lib); continue; + } // Generate data file FILE* fd = tmpfile(); @@ -430,6 +436,8 @@ slv2_world_load_bundle(SLV2World world, SLV2Value bundle_uri) &manifest_uri, binary, bundle_node); } slv2_match_end(plug_results); + + dlclose(lib); } slv2_match_end(dmanifests); #endif // SLV2_DYN_MANIFEST -- cgit v1.2.1