diff options
author | David Robillard <d@drobilla.net> | 2011-01-20 18:00:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-01-20 18:00:07 +0000 |
commit | 1c5d7f65aee365a856415adf8dbbcf4dfffa0fa6 (patch) | |
tree | 6b9d7ed6afdce9e166d7ce42f54870b1e761e052 | |
parent | b40edc21bf6f5b2573092c835538b48bff8b489c (diff) | |
download | serd-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
-rw-r--r-- | src/uri.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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); |