From bbeee0013c9a0bed0d8f0ca93e9789f99e5249b1 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 15 May 2022 06:49:31 +0300 Subject: [PATCH 39/39] rssanity.c: Free action enabler fix suggestions See osdn #44432 Signed-off-by: Marko Lindqvist --- common/actions.c | 2 +- server/rssanity.c | 2 ++ tools/ruledit/tab_enablers.cpp | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/actions.c b/common/actions.c index 3bba026f77..07a0cb7f52 100644 --- a/common/actions.c +++ b/common/actions.c @@ -2880,7 +2880,7 @@ enabler_first_self_contradiction(const struct action_enabler *enabler) /**********************************************************************//** Returns a suggestion to fix the specified action enabler or NULL if no fix is found to be needed. It is the responsibility of the caller to - free the suggestion when it is done with it. + free the suggestion with req_vec_problem_free() when it is done with it. **************************************************************************/ struct req_vec_problem * action_enabler_suggest_repair(const struct action_enabler *enabler) diff --git a/server/rssanity.c b/server/rssanity.c index 12ecf87821..f1499f5c0c 100644 --- a/server/rssanity.c +++ b/server/rssanity.c @@ -1247,6 +1247,7 @@ bool sanity_check_ruleset_data(struct rscompat_info *compat) if (problem != NULL) { ruleset_error(LOG_ERROR, "%s", problem->description); + req_vec_problem_free(problem); ok = FALSE; } @@ -1254,6 +1255,7 @@ bool sanity_check_ruleset_data(struct rscompat_info *compat) if (problem != NULL) { /* There is a potential for improving this enabler. */ log_deprecation("%s", problem->description); + req_vec_problem_free(problem); } } } action_enabler_list_iterate_end; diff --git a/tools/ruledit/tab_enablers.cpp b/tools/ruledit/tab_enablers.cpp index 1735c8dcb9..c396ea2c45 100644 --- a/tools/ruledit/tab_enablers.cpp +++ b/tools/ruledit/tab_enablers.cpp @@ -474,11 +474,13 @@ const char *fix_enabler_item::name() /**********************************************************************//** Returns the next detected requirement vector problem for the ruleset item or nullptr if no fix is found to be needed. + Caller needs to free the result with req_vec_problem_free() @return the next requirement vector problem for the item. **************************************************************************/ struct req_vec_problem *fix_enabler_item::find_next_problem(void) { struct req_vec_problem *out = action_enabler_suggest_repair(local_copy); + if (out != NULL) { return out; } -- 2.35.1