summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-07-17 17:22:53 +0200
committerDavid Robillard <d@drobilla.net>2020-07-17 17:22:53 +0200
commite6ad91a2221ef9f49bfec54a7290c96e4b751427 (patch)
tree3e4225cd25e85bc13964033fc5b0cf498c5580d6
parentf8741be1a83993c2699e4403c895d433c0d8c1fc (diff)
downloadlilv-e6ad91a2221ef9f49bfec54a7290c96e4b751427.tar.gz
lilv-e6ad91a2221ef9f49bfec54a7290c96e4b751427.tar.bz2
lilv-e6ad91a2221ef9f49bfec54a7290c96e4b751427.zip
Fix potential NULL dereference warning
Not really something that matters in these cases since allocation failure is not handled gracefully anyway.
-rw-r--r--src/node.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/node.c b/src/node.c
index 6a6c4f6..0ed733a 100644
--- a/src/node.c
+++ b/src/node.c
@@ -182,7 +182,9 @@ lilv_new_int(LilvWorld* world, int val)
char str[32];
snprintf(str, sizeof(str), "%d", val);
LilvNode* ret = lilv_node_new(world, LILV_VALUE_INT, str);
- ret->val.int_val = val;
+ if (ret) {
+ ret->val.int_val = val;
+ }
return ret;
}
@@ -192,7 +194,9 @@ lilv_new_float(LilvWorld* world, float val)
char str[32];
snprintf(str, sizeof(str), "%f", val);
LilvNode* ret = lilv_node_new(world, LILV_VALUE_FLOAT, str);
- ret->val.float_val = val;
+ if (ret) {
+ ret->val.float_val = val;
+ }
return ret;
}
@@ -201,7 +205,9 @@ lilv_new_bool(LilvWorld* world, bool val)
{
LilvNode* ret = lilv_node_new(world, LILV_VALUE_BOOL,
val ? "true" : "false");
- ret->val.bool_val = val;
+ if (ret) {
+ ret->val.bool_val = val;
+ }
return ret;
}