aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-20 18:00:07 +0000
committerDavid Robillard <d@drobilla.net>2011-01-20 18:00:07 +0000
commit1c5d7f65aee365a856415adf8dbbcf4dfffa0fa6 (patch)
tree6b9d7ed6afdce9e166d7ce42f54870b1e761e052 /src
parentb40edc21bf6f5b2573092c835538b48bff8b489c (diff)
downloadserd-1c5d7f65aee365a856415adf8dbbcf4dfffa0fa6.tar.gz
serd-1c5d7f65aee365a856415adf8dbbcf4dfffa0fa6.tar.bz2
serd-1c5d7f65aee365a856415adf8dbbcf4dfffa0fa6.zip
Fix memory errors (full test suite passes with zero errors or leaks reported by valgrind).
git-svn-id: http://svn.drobilla.net/serd/trunk@11 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r--src/uri.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/uri.c b/src/uri.c
index 27a53a40..5f7a405e 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -381,7 +381,6 @@ SerdString*
serd_string_new_from_uri(const SerdURI* uri, SerdURI* out)
{
const size_t len = serd_uri_string_length(uri);
- //SerdString* str = calloc(sizeof(SerdString) + len + 1, 1);
SerdString* str = malloc(sizeof(SerdString) + len + 1);
str->n_bytes = len + 1;
str->n_chars = len; // FIXME: UTF-8
@@ -389,9 +388,9 @@ serd_string_new_from_uri(const SerdURI* uri, SerdURI* out)
uint8_t* ptr = str->buf;
const size_t actual_len = serd_uri_serialise(uri, string_sink, &ptr);
- str->buf[actual_len + 1] = '\0';
+ str->buf[actual_len] = '\0';
str->n_bytes = actual_len + 1;
- str->n_chars = str->n_bytes - 1;
+ str->n_chars = str->n_bytes - 1; // FIXME: UTF-8
#ifdef URI_DEBUG
fwrite("URI: `'", 1, 6, stderr);