Fix: ctf: set `ret` on error paths
[babeltrace.git] / src / plugins / ctf / common / metadata / visitor-generate-ir.c
index 810f3ed1fa86ab022d495531aec059f361a81e4a..a7ea0f0978f87cae6316560a3b026a8f936c88a0 100644 (file)
@@ -3721,6 +3721,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node)
                        _BT_COMP_LOGE_NODE(node,
                                "Stream class has a `id` attribute, "
                                "but trace has no packet header field class.");
+                       ret = -EINVAL;
                        goto error;
                }
 
@@ -3730,6 +3731,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node)
                        _BT_COMP_LOGE_NODE(node,
                                "Stream class has a `id` attribute, "
                                "but trace's packet header field class has no `stream_id` field.");
+                       ret = -EINVAL;
                        goto error;
                }
 
@@ -3738,6 +3740,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node)
                        _BT_COMP_LOGE_NODE(node,
                                "Stream class has a `id` attribute, "
                                "but trace's packet header field class's `stream_id` field is not an integer field class.");
+                       ret = -EINVAL;
                        goto error;
                }
        } else {
@@ -3832,6 +3835,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
                        if (val != 1) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Invalid trace's `minor` attribute: expecting 1.");
+                               ret = -EINVAL;
                                goto error;
                        }
 
@@ -3856,6 +3860,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
                        if (val != 8) {
                                _BT_COMP_LOGE_NODE(node,
                                        "Invalid trace's `minor` attribute: expecting 8.");
+                               ret = -EINVAL;
                                goto error;
                        }
 
This page took 0.023908 seconds and 4 git commands to generate.