aboutsummaryrefslogtreecommitdiffstats
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/env.c b/src/env.c
index 605be6e6..c37b6b6b 100644
--- a/src/env.c
+++ b/src/env.c
@@ -245,10 +245,9 @@ serd_env_expand_node(const SerdEnv* env,
return SERD_NODE_NULL;
}
const size_t len = prefix.len + suffix.len; // FIXME: UTF-8?
- SerdNode ret = { NULL, len, len, 0, SERD_URI };
- ret.buf = (uint8_t*)malloc(ret.n_bytes + 1);
- snprintf((char*)ret.buf, ret.n_bytes + 1,
- "%s%s", prefix.buf, suffix.buf);
+ uint8_t* buf = (uint8_t*)malloc(len + 1);
+ SerdNode ret = { buf, len, len, 0, SERD_URI };
+ snprintf((char*)buf, ret.n_bytes + 1, "%s%s", prefix.buf, suffix.buf);
return ret;
}
case SERD_URI: {