summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib.c11
-rw-r--r--src/node.c6
-rw-r--r--src/state.c7
-rw-r--r--test/lilv_test.c4
4 files changed, 17 insertions, 11 deletions
diff --git a/src/lib.c b/src/lib.c
index bd7233b..68eff47 100644
--- a/src/lib.c
+++ b/src/lib.c
@@ -40,7 +40,8 @@ lilv_lib_open(LilvWorld* world,
}
const char* const lib_uri = lilv_node_as_uri(uri);
- char* const lib_path = lilv_file_uri_parse(lib_uri, NULL);
+ char* const lib_path = (char*)serd_file_uri_parse(
+ (const uint8_t*)lib_uri, NULL);
if (!lib_path) {
return NULL;
}
@@ -49,7 +50,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());
- lilv_free(lib_path);
+ serd_free(lib_path);
return NULL;
}
@@ -65,17 +66,17 @@ lilv_lib_open(LilvWorld* world,
if (!desc) {
LILV_ERRORF("Call to %s:lv2_lib_descriptor failed\n", lib_path);
dlclose(lib);
- lilv_free(lib_path);
+ serd_free(lib_path);
return NULL;
}
} else if (!df) {
LILV_ERRORF("No `lv2_descriptor' or `lv2_lib_descriptor' in %s\n",
lib_path);
dlclose(lib);
- lilv_free(lib_path);
+ serd_free(lib_path);
return NULL;
}
- lilv_free(lib_path);
+ serd_free(lib_path);
LilvLib* llib = (LilvLib*)malloc(sizeof(LilvLib));
llib->world = world;
diff --git a/src/node.c b/src/node.c
index 7dd6551..95f6a8c 100644
--- a/src/node.c
+++ b/src/node.c
@@ -283,11 +283,13 @@ lilv_node_get_turtle_token(const LilvNode* value)
break;
case LILV_VALUE_INT:
node = serd_node_new_integer(value->val.int_val);
- result = (char*)node.buf;
+ result = lilv_strdup((char*)node.buf);
+ serd_node_free(&node);
break;
case LILV_VALUE_FLOAT:
node = serd_node_new_decimal(value->val.float_val, 8);
- result = (char*)node.buf;
+ result = lilv_strdup((char*)node.buf);
+ serd_node_free(&node);
break;
}
diff --git a/src/state.c b/src/state.c
index 2b6b113..3841c75 100644
--- a/src/state.c
+++ b/src/state.c
@@ -618,7 +618,7 @@ new_state_from_model(LilvWorld* world,
sord_node_free(world->world, state_node);
sord_node_free(world->world, statep);
- free((void*)chunk.buf);
+ serd_free((void*)chunk.buf);
sratom_free(sratom);
if (state->props.props) {
@@ -1153,7 +1153,10 @@ lilv_state_to_string(LilvWorld* world,
serd_writer_free(writer);
serd_env_free(env);
- return (char*)serd_chunk_sink_finish(&chunk);
+ char* str = (char*)serd_chunk_sink_finish(&chunk);
+ char* result = lilv_strdup(str);
+ serd_free(str);
+ return result;
}
static void
diff --git a/test/lilv_test.c b/test/lilv_test.c
index ca56819..6e1f63c 100644
--- a/test/lilv_test.c
+++ b/test/lilv_test.c
@@ -1640,7 +1640,7 @@ test_state(void)
// Ensure they are equal
TEST_ASSERT(lilv_state_equals(state, from_str));
- free(state1_str);
+ lilv_free(state1_str);
const LilvNode* state_plugin_uri = lilv_state_get_plugin_uri(state);
TEST_ASSERT(lilv_node_equals(state_plugin_uri, plugin_uri));
@@ -1719,7 +1719,7 @@ test_state(void)
lilv_world_load_bundle(world, test_state_bundle);
lilv_world_load_resource(world, test_state_node);
serd_node_free(&state6_uri);
- free(state6_path);
+ lilv_free(state6_path);
LilvState* state6 = lilv_state_new_from_world(world, &map, test_state_node);
TEST_ASSERT(lilv_state_equals(state, state6)); // Round trip accuracy