aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/namespaces.c6
-rw-r--r--src/serdi.c6
-rw-r--r--src/string.c7
3 files changed, 13 insertions, 6 deletions
diff --git a/src/namespaces.c b/src/namespaces.c
index b14d74c5..6c400a3c 100644
--- a/src/namespaces.c
+++ b/src/namespaces.c
@@ -47,8 +47,8 @@ void
serd_namespaces_free(SerdNamespaces ns)
{
for (size_t i = 0; i < ns->n_namespaces; ++i) {
- free(ns->namespaces[i].name);
- free(ns->namespaces[i].uri);
+ serd_string_free(ns->namespaces[i].name);
+ serd_string_free(ns->namespaces[i].uri);
}
free(ns->namespaces);
free(ns);
@@ -80,7 +80,7 @@ serd_namespaces_add(SerdNamespaces ns,
assert(uri);
SerdNamespace* const record = serd_namespaces_find(ns, name->buf, name->n_chars);
if (record) {
- free(record->uri);
+ serd_string_free(record->uri);
record->uri = serd_string_copy(uri);
} else {
++ns->n_namespaces;
diff --git a/src/serdi.c b/src/serdi.c
index 548f88e7..13fdb2af 100644
--- a/src/serdi.c
+++ b/src/serdi.c
@@ -60,7 +60,7 @@ event_base(void* handle,
}
// Replace the old base URI
- free(state->base_uri_str);
+ serd_string_free(state->base_uri_str);
state->base_uri_str = base_uri_str;
state->base_uri = base_uri;
@@ -85,7 +85,7 @@ event_prefix(void* handle,
SerdURI new_abs_uri;
SerdString* abs_uri_string = serd_string_new_from_uri(&abs_uri, &new_abs_uri);
serd_namespaces_add(state->ns, name, abs_uri_string);
- free(abs_uri_string);
+ serd_string_free(abs_uri_string);
} else {
serd_namespaces_add(state->ns, name, uri_string);
}
@@ -155,7 +155,7 @@ main(int argc, char** argv)
serd_reader_free(reader);
fclose(in_fd);
serd_namespaces_free(state.ns);
- free(state.base_uri_str);
+ serd_string_free(state.base_uri_str);
if (success) {
return 0;
diff --git a/src/string.c b/src/string.c
index 301a98cc..0f5d2430 100644
--- a/src/string.c
+++ b/src/string.c
@@ -63,3 +63,10 @@ serd_string_copy(const SerdString* s)
}
return NULL;
}
+
+SERD_API
+void
+serd_string_free(SerdString* str)
+{
+ free(str);
+}