aboutsummaryrefslogtreecommitdiffstats
path: root/src/env.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-04-11 18:49:32 +0000
committerDavid Robillard <d@drobilla.net>2014-04-11 18:49:32 +0000
commit85a7ec2b8e11085b74c3a5966753a0b43a264c8a (patch)
tree07af4e12f66bb695e6969602d06b1b69918a72c3 /src/env.c
parent60df320d954e5a82c7c4abc213bc4d396a3ef271 (diff)
downloadserd-85a7ec2b8e11085b74c3a5966753a0b43a264c8a.tar.gz
serd-85a7ec2b8e11085b74c3a5966753a0b43a264c8a.tar.bz2
serd-85a7ec2b8e11085b74c3a5966753a0b43a264c8a.zip
Minor hardening.
git-svn-id: http://svn.drobilla.net/serd/trunk@459 490d8e77-9747-427b-9fa3-0b8f29cee8a0
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(