commit 51b2c5c: [Fix] Lua: task:remove_result didn't work in some cases

Andrew Lewis nerf at judo.za.org
Wed Feb 2 20:14:04 UTC 2022


Author: Andrew Lewis
Date: 2022-02-02 12:14:29 +0200
URL: https://github.com/rspamd/rspamd/commit/51b2c5c23e056be10ff7394f07f5eb4a2a6377f7 (refs/pull/4056/head)

[Fix] Lua: task:remove_result didn't work in some cases

---
 src/libmime/scan_result.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c
index 8f9d799fe..4afee30e1 100644
--- a/src/libmime/scan_result.c
+++ b/src/libmime/scan_result.c
@@ -1016,15 +1016,16 @@ struct rspamd_symbol_result* rspamd_task_remove_symbol_result (
 			if (result->sym_groups && res->sym) {
 				struct rspamd_symbol_group *gr;
 				gint i;
+				khiter_t k_groups;
 
 				PTR_ARRAY_FOREACH (res->sym->groups, i, gr) {
 					gdouble *gr_score;
 
-					k = kh_get (rspamd_symbols_group_hash,
+					k_groups = kh_get (rspamd_symbols_group_hash,
 							result->sym_groups, gr);
 
-					if (k != kh_end (result->sym_groups)) {
-						gr_score = &kh_value (result->sym_groups, k);
+					if (k_groups != kh_end (result->sym_groups)) {
+						gr_score = &kh_value (result->sym_groups, k_groups);
 
 						if (gr_score) {
 							*gr_score -= res->score;
@@ -1083,4 +1084,4 @@ rspamd_find_metric_result (struct rspamd_task *task,
 	}
 
 	return NULL;
-}
\ No newline at end of file
+}


More information about the Commits mailing list