diff options
-rw-r--r-- | lilv/lilv.h | 11 | ||||
-rw-r--r-- | src/scalepoint.c | 8 | ||||
-rw-r--r-- | src/world.c | 4 |
3 files changed, 16 insertions, 7 deletions
diff --git a/lilv/lilv.h b/lilv/lilv.h index 305e8e1..b5a84e7 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -145,14 +145,15 @@ LilvNode* lilv_new_bool(LilvWorld* world, bool val); /** - Free an LilvNode. + Free a LilvNode. + It is safe to call this function on NULL. */ LILV_API void lilv_node_free(LilvNode* val); /** - Duplicate an LilvNode. + Duplicate a LilvNode. */ LILV_API LilvNode* @@ -538,6 +539,7 @@ lilv_world_set_option(LilvWorld* world, /** Destroy the world, mwahaha. + It is safe to call this function on NULL. Note that destroying @a world will destroy all the objects it contains (e.g. instances of LilvPlugin). Do not destroy the world until you are finished with all objects that came from it. @@ -722,7 +724,7 @@ lilv_plugin_get_class(const LilvPlugin* plugin); <code><plugin-uri> predicate ?object</code> May return NULL if the property was not found, or if object(s) is not - sensibly represented as an LilvNodes (e.g. blank nodes). + sensibly represented as a LilvNodes (e.g. blank nodes). Return value must be freed by caller with lilv_nodes_free. */ LILV_API @@ -974,7 +976,7 @@ lilv_port_get_classes(const LilvPlugin* plugin, /** Determine if a port is of a given class (input, output, audio, etc). For convenience/performance/extensibility reasons, hosts are expected to - create an LilvNode for each port class they "care about". Well-known type + create a LilvNode for each port class they "care about". Well-known type URI strings are defined (e.g. LILV_PORT_CLASS_INPUT) for convenience, but this function is designed so that Lilv is usable with any port types without requiring explicit support in Lilv. @@ -1118,6 +1120,7 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, /** Free a plugin instance. + It is safe to call this function on NULL. @a instance is invalid after this call. */ LILV_API diff --git a/src/scalepoint.c b/src/scalepoint.c index 6995b85..0138e61 100644 --- a/src/scalepoint.c +++ b/src/scalepoint.c @@ -30,9 +30,11 @@ lilv_scale_point_new(LilvNode* value, LilvNode* label) void lilv_scale_point_free(LilvScalePoint* point) { - lilv_node_free(point->value); - lilv_node_free(point->label); - free(point); + if (point) { + lilv_node_free(point->value); + lilv_node_free(point->label); + free(point); + } } LILV_API diff --git a/src/world.c b/src/world.c index e2456dd..e94bcd8 100644 --- a/src/world.c +++ b/src/world.c @@ -100,6 +100,10 @@ LILV_API void lilv_world_free(LilvWorld* world) { + if (!world) { + return NULL; + } + lilv_plugin_class_free(world->lv2_plugin_class); world->lv2_plugin_class = NULL; |