aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-18 12:58:47 -0400
committerDavid Robillard <d@drobilla.net>2016-09-18 13:00:45 -0400
commitb5d531a26d2b56108e1228e908c54620fbbc736b (patch)
treeabced43e90386cefd6f332ef686bb4489ae62bf3
parent584305d0be82b8a135d77af3c058bcd6bb216d28 (diff)
downloadserd-b5d531a26d2b56108e1228e908c54620fbbc736b.tar.gz
serd-b5d531a26d2b56108e1228e908c54620fbbc736b.tar.bz2
serd-b5d531a26d2b56108e1228e908c54620fbbc736b.zip
Fix memory error
Introduced in 443f470383dc3acba0fde7b705e8ff81a7c49595
-rw-r--r--src/env.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/env.c b/src/env.c
index a753c140..92cb4150 100644
--- a/src/env.c
+++ b/src/env.c
@@ -245,8 +245,9 @@ serd_env_expand_node(const SerdEnv* env,
}
const size_t len = prefix.len + suffix.len;
uint8_t* buf = (uint8_t*)malloc(len + 1);
- SerdNode ret = { buf, len, serd_strlen(buf, NULL, NULL), 0, SERD_URI };
- snprintf((char*)buf, ret.n_bytes + 1, "%s%s", prefix.buf, suffix.buf);
+ SerdNode ret = { buf, len, 0, 0, SERD_URI };
+ snprintf((char*)buf, len + 1, "%s%s", prefix.buf, suffix.buf);
+ ret.n_chars = serd_strlen(buf, NULL, NULL);
return ret;
}
case SERD_URI: {