summaryrefslogtreecommitdiffstats
path: root/src/syntax.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-02-04 03:17:39 +0000
committerDavid Robillard <d@drobilla.net>2011-02-04 03:17:39 +0000
commit1cf3c5d35406e424f52903e37cb5b7b0877512e7 (patch)
treeb0a48d6390f644c079a7740b2b9c19e83f4f3311 /src/syntax.c
parenta161fecabd48e7b42c313dcc0132c7c5378d9ca2 (diff)
downloadsord-1cf3c5d35406e424f52903e37cb5b7b0877512e7.tar.gz
sord-1cf3c5d35406e424f52903e37cb5b7b0877512e7.tar.bz2
sord-1cf3c5d35406e424f52903e37cb5b7b0877512e7.zip
Fix memory leaks.
git-svn-id: http://svn.drobilla.net/sord/trunk@18 3d64ff67-21c5-427c-a301-fe4f08042e5a
Diffstat (limited to 'src/syntax.c')
-rw-r--r--src/syntax.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/syntax.c b/src/syntax.c
index ac1a766..e7560c5 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -114,7 +114,9 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn)
}
SerdURI ignored;
SerdNode abs_uri_node = serd_node_new_uri(&abs_uri, &ignored);
- return sord_get_uri(state->sord, true, (const char*)abs_uri_node.buf);
+ SordID ret = sord_get_uri(state->sord, true, (const char*)abs_uri_node.buf);
+ serd_node_free(&abs_uri_node);
+ return ret;
}
case SERD_CURIE: {
SerdChunk uri_prefix;
@@ -124,12 +126,14 @@ sord_node_from_serd_node(ReadState* state, const SerdNode* sn)
return NULL;
}
const size_t uri_len = uri_prefix.len + uri_suffix.len;
- char* buf = malloc(uri_len + 1);
+ char* buf = malloc(uri_len + 1);
memcpy(buf, uri_prefix.buf, uri_prefix.len);
memcpy(buf + uri_prefix.len, uri_suffix.buf, uri_suffix.len);
buf[uri_len] = '\0';
- return sord_get_uri_counted(state->sord, true,
- buf, uri_prefix.len + uri_suffix.len);
+ SordID ret = sord_get_uri_counted(state->sord, true,
+ buf, uri_prefix.len + uri_suffix.len);
+ free(buf);
+ return ret;
}
case SERD_BLANK_ID:
case SERD_ANON_BEGIN: