diff --git a/src/ly_common.c b/src/ly_common.c index 449c862f9..ac62677ef 100644 --- a/src/ly_common.c +++ b/src/ly_common.c @@ -325,6 +325,7 @@ ly_utf8_and_equal(const char *input, int bytes, ...) /* compare each byte */ if (((uint8_t)input[i] & and) != (uint8_t)byte) { + va_end(ap); return 0; } } @@ -355,8 +356,10 @@ ly_utf8_less(const char *input, int bytes, ...) /* compare until bytes differ */ if ((uint8_t)input[i] > (uint8_t)byte) { + va_end(ap); return 0; } else if ((uint8_t)input[i] < (uint8_t)byte) { + va_end(ap); return 1; } } @@ -388,8 +391,10 @@ ly_utf8_greater(const char *input, int bytes, ...) /* compare until bytes differ */ if ((uint8_t)input[i] > (uint8_t)byte) { + va_end(ap); return 1; } else if ((uint8_t)input[i] < (uint8_t)byte) { + va_end(ap); return 0; } } diff --git a/src/parser_lyb.c b/src/parser_lyb.c index 342a02dd0..66ac68663 100644 --- a/src/parser_lyb.c +++ b/src/parser_lyb.c @@ -773,6 +773,7 @@ lyb_parse_schema_hash(struct lyd_lyb_ctx *lybctx, const struct lysc_node *sparen LOGERR(lybctx->lybctx->ctx, LY_EINT, "Failed to find matching hash for a top-level node from \"%s\".", mod->name); } else { + assert(sparent); LOGERR(lybctx->lybctx->ctx, LY_EINT, "Failed to find matching hash for a child node of \"%s\".", sparent->name); } diff --git a/src/parser_yin.c b/src/parser_yin.c index a280423d8..fb10e1784 100644 --- a/src/parser_yin.c +++ b/src/parser_yin.c @@ -396,6 +396,7 @@ subelems_allocator(struct lysp_yin_ctx *ctx, size_t count, struct lysp_node *par return LY_SUCCESS; mem_err: + va_end(ap); subelems_deallocator(count, *result); LOGMEM(ctx->xmlctx->ctx); return LY_EMEM; diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c index 15f36bb49..5498b208e 100644 --- a/src/schema_compile_node.c +++ b/src/schema_compile_node.c @@ -1229,6 +1229,7 @@ lys_compile_pattern_chblocks_xmlschema2perl(const struct ly_ctx *ctx, const char ++idx; } if ((perl_regex[idx2] == ']') && (!idx2 || (perl_regex[idx2 - 1] != '\\'))) { + assert(idx); --idx; } } diff --git a/src/xpath.c b/src/xpath.c index 6b1a3c64e..99a4a2278 100644 --- a/src/xpath.c +++ b/src/xpath.c @@ -8256,6 +8256,7 @@ eval_name_test_with_predicate(const struct lyxp_expr *exp, uint32_t *tok_idx, en if (set->used) { i = set->used; + assert(i); do { --i; if (set->val.scnodes[i].in_ctx > LYXP_SET_SCNODE_ATOM_NODE) {