From 35354abb37202f99bec2d65e437dd7e2f8ffbc9d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Dec 2024 19:06:07 -0500 Subject: Fix potential memory leaks --- src/port.c | 5 ++++- src/world.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/port.c b/src/port.c index 4ad5d70..a04298c 100644 --- a/src/port.c +++ b/src/port.c @@ -223,7 +223,7 @@ lilv_port_get_scale_points(const LilvPlugin* plugin, const LilvPort* port) sord_new_uri(plugin->world->world, (const uint8_t*)LV2_CORE__scalePoint), NULL); - if (sord_iter_end(points)) { + if (!points) { return NULL; } @@ -240,6 +240,9 @@ lilv_port_get_scale_points(const LilvPlugin* plugin, const LilvPort* port) if (value && label) { zix_tree_insert((ZixTree*)ret, lilv_scale_point_new(value, label), NULL); + } else { + lilv_node_free(label); + lilv_node_free(value); } } sord_iter_free(points); diff --git a/src/world.c b/src/world.c index 42e644c..b299794 100644 --- a/src/world.c +++ b/src/world.c @@ -884,6 +884,7 @@ lilv_world_drop_graph(LilvWorld* world, const SordNode* graph) while (!sord_iter_end(i)) { const SerdStatus st = sord_erase(world->model, i); if (st) { + sord_iter_free(i); LILV_ERRORF("Error removing statement from <%s> (%s)\n", sord_node_get_string(graph), serd_strerror(st)); -- cgit v1.2.1