From e6ad91a2221ef9f49bfec54a7290c96e4b751427 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 17 Jul 2020 17:22:53 +0200 Subject: Fix potential NULL dereference warning Not really something that matters in these cases since allocation failure is not handled gracefully anyway. --- src/node.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/node.c') 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; } -- cgit v1.2.1