diff options
author | David Robillard <d@drobilla.net> | 2020-07-17 17:22:53 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-07-17 17:22:53 +0200 |
commit | e6ad91a2221ef9f49bfec54a7290c96e4b751427 (patch) | |
tree | 3e4225cd25e85bc13964033fc5b0cf498c5580d6 /src | |
parent | f8741be1a83993c2699e4403c895d433c0d8c1fc (diff) | |
download | lilv-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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; } |