Fix: Dereference null return value
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Jul 2017 16:06:53 +0000 (12:06 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 9 Aug 2017 18:56:40 +0000 (14:56 -0400)
Found by Coverity:

2. returned_null: bt_ctf_field_type_variant_get_tag_name returns null
(checked 4 out of 5 times).

3. var_assigned: Assigning: pathstr = null return value from
bt_ctf_field_type_variant_get_tag_name.

CID 1376176 (#1 of 1): Dereference null return value (NULL_RETURNS).
dereference: Dereferencing a pointer that might be null pathstr when
calling pathstr_to_field_path.

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

index b4a9c58cb821df1753921ecfae6d9e8d08c2a631..c8648254faed43eaadf540e2b09d9059696d3de2 100644 (file)
@@ -1023,6 +1023,12 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type,
                abort();
        }
 
+       if (!pathstr) {
+               BT_LOGW_STR("Cannot get path string.");
+               ret = -1;
+               goto end;
+       }
+
        /* Get target field path out of path string */
        target_field_path = pathstr_to_field_path(pathstr, ctx);
        if (!target_field_path) {
This page took 0.02516 seconds and 4 git commands to generate.