From 126e208fa58bc787aa7e96990e83031dfcd463be Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 May 2011 23:31:59 +0000 Subject: Fix crash when setting an identical namespace prefix. git-svn-id: http://svn.drobilla.net/serd/trunk@169 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- src/env.c | 3 ++- src/writer.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/env.c b/src/env.c index 0d9bc128..26c7eb11 100644 --- a/src/env.c +++ b/src/env.c @@ -111,8 +111,9 @@ serd_env_add(SerdEnv* env, assert(name && uri); SerdPrefix* const prefix = serd_env_find(env, name->buf, name->n_chars); if (prefix) { - serd_node_free(&prefix->uri); + SerdNode old_prefix_uri = prefix->uri; prefix->uri = serd_node_copy(uri); + serd_node_free(&old_prefix_uri); } else { env->prefixes = realloc(env->prefixes, (++env->n_prefixes) * sizeof(SerdPrefix)); diff --git a/src/writer.c b/src/writer.c index a9cdf6ac..13015d8c 100644 --- a/src/writer.c +++ b/src/writer.c @@ -31,7 +31,7 @@ typedef struct { } WriteContext; static const WriteContext WRITE_CONTEXT_NULL = { - { 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} + {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }; struct SerdWriterImpl { -- cgit v1.2.1