From: Jérémie Galarneau Date: Sat, 27 May 2017 19:40:58 +0000 (-0400) Subject: Fix: return error on empty list in get_unary_unsigned X-Git-Tag: v2.0.0-pre1~144 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=d82c602ed5c07e996269443686ae671537955cc5 Fix: return error on empty list in get_unary_unsigned Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index badbf995..fb0f1df1 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -855,6 +855,11 @@ int get_unary_unsigned(struct bt_list_head *head, uint64_t *value) int ret = 0; struct ctf_node *node; + if (bt_list_empty(head)) { + ret = -1; + goto end; + } + bt_list_for_each_entry(node, head, siblings) { int uexpr_type = node->u.unary_expression.type; int uexpr_link = node->u.unary_expression.link;