Skip to content

Commit

Permalink
path BUGFIX free out params on error
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvasko committed Oct 1, 2024
1 parent cef2b59 commit 9805f21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,6 @@ ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_
/* names (keys) are unique - it was checked when parsing */
LOGVAL(ctx, LYVE_XPATH, "Predicate missing for a key of %s \"%s\" in path.",
lys_nodetype2str(ctx_node->nodetype), ctx_node->name);
ly_path_predicates_free(ctx_node->module->ctx, *predicates);
*predicates = NULL;
ret = LY_EVALID;
goto cleanup;
}
Expand Down Expand Up @@ -813,6 +811,10 @@ ly_path_compile_predicate(const struct ly_ctx *ctx, const struct lysc_node *cur_

cleanup:
LOG_LOCBACK(cur_node ? 1 : 0, 0);
if (ret) {
ly_path_predicates_free(ctx_node->module->ctx, *predicates);
*predicates = NULL;
}
return ret;
}

Expand Down

0 comments on commit 9805f21

Please sign in to comment.