aboutsummaryrefslogtreecommitdiffstats
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/env.c b/src/env.c
index c37b6b6b..77682d6d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -36,12 +36,8 @@ SERD_API
SerdEnv*
serd_env_new(const SerdNode* base_uri)
{
- SerdEnv* env = (SerdEnv*)malloc(sizeof(struct SerdEnvImpl));
- env->prefixes = NULL;
- env->n_prefixes = 0;
- env->base_uri_node = SERD_NODE_NULL;
- env->base_uri = SERD_URI_NULL;
- if (base_uri) {
+ SerdEnv* env = (SerdEnv*)calloc(sizeof(struct SerdEnvImpl), 1);
+ if (env && base_uri) {
serd_env_set_base_uri(env, base_uri);
}
return env;
@@ -76,6 +72,10 @@ SerdStatus
serd_env_set_base_uri(SerdEnv* env,
const SerdNode* uri_node)
{
+ if (!env || !uri_node) {
+ return SERD_ERR_BAD_ARG;
+ }
+
// Resolve base URI and create a new node and URI for it
SerdURI base_uri;
SerdNode base_uri_node = serd_node_new_uri_from_node(