Fix: unchecked return value
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 3 Aug 2017 13:43:29 +0000 (09:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 9 Aug 2017 20:48:38 +0000 (16:48 -0400)
Found by Coverity:

CID 1376155 (#1 of 1): Unchecked return value (CHECKED_RETURN).
check_return: Calling bt_value_string_get without checking return value
(as is done elsewhere 44 out of 47 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
cli/babeltrace.c

index f4bb4a91d72bd8ca42edf6d237762de216450e80..540bd11dd7500d6bbf4a09dde3713fde9a44dfdf 100644 (file)
@@ -595,10 +595,15 @@ int load_dynamic_plugins(struct bt_value *plugin_paths)
                struct bt_value *plugin_path_value = NULL;
                const char *plugin_path;
                struct bt_plugin_set *plugin_set;
+               enum bt_value_status status;
 
                plugin_path_value = bt_value_array_get(plugin_paths, i);
-               bt_value_string_get(plugin_path_value, &plugin_path);
-               assert(plugin_path);
+               status = bt_value_string_get(plugin_path_value, &plugin_path);
+               if (status != BT_VALUE_STATUS_OK) {
+                       BT_LOGD_STR("Cannot get plugin path string.");
+                       BT_PUT(plugin_path_value);
+                       continue;
+               }
 
                /*
                 * Skip this if the directory does not exist because
This page took 0.026591 seconds and 4 git commands to generate.