ret = get_unary_unsigned(&node->u.ctf_expression.right,
(uint64_t *) &id);
- if (ret || id < 0) {
+ /* Only read "id" if get_unary_unsigned() succeeded. */
+ if (ret || (!ret && id < 0)) {
_PERROR("%s", "unexpected unary expression for event declaration's \"id\" attribute");
ret = -EINVAL;
goto error;
ret = get_unary_unsigned(&node->u.ctf_expression.right,
(uint64_t *) stream_id);
- if (ret || *stream_id < 0) {
+ /*
+ * Only read "stream_id" if get_unary_unsigned()
+ * succeeded.
+ */
+ if (ret || (!ret && *stream_id < 0)) {
_PERROR("%s", "unexpected unary expression for event declaration's \"stream_id\" attribute");
ret = -EINVAL;
goto error;
ret = get_unary_unsigned(&node->u.ctf_expression.right,
(uint64_t *) &id);
- if (ret || id < 0) {
+ /* Only read "id" if get_unary_unsigned() succeeded. */
+ if (ret || (!ret && id < 0)) {
_PERROR("%s", "unexpected unary expression for stream declaration's \"id\" attribute");
ret = -EINVAL;
goto error;