From fbc4e0379c800aad235ece26d517f57e3911a26f Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Tue, 20 Nov 2007 22:42:31 +0100
Subject: [PATCH] Last commit broke execution of match types other than
 :regex...fixed.

---
 src/lib-sieve/sieve-match-types.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/lib-sieve/sieve-match-types.c b/src/lib-sieve/sieve-match-types.c
index af2739ebe..a129ca122 100644
--- a/src/lib-sieve/sieve-match-types.c
+++ b/src/lib-sieve/sieve-match-types.c
@@ -465,17 +465,20 @@ bool sieve_match_value
 	while ( sieve_coded_stringlist_next_item(mctx->key_list, &key_item) && 
 		key_item != NULL ) 
 	{
-		void * const *kctx;
-
-		if ( mctx->value_index == 0 && mtch->match_init != NULL ) {
-			void *key_ctx = mtch->match_init(
-				mctx->match_type, mctx->comparator,
-				str_c(key_item), str_len(key_item)); 
-
-			kctx = &key_ctx;
-			array_idx_set(&mctx->key_contexts, key_index, kctx); 
-		} else 
-			kctx = array_idx(&mctx->key_contexts, key_index);
+		void *key_ctx = NULL;
+		void * const *kctx = &key_ctx;
+
+		if ( mtch->match_init != NULL ) {
+			if ( mctx->value_index == 0 ) {
+				key_ctx = mtch->match_init(
+					mctx->match_type, mctx->comparator,
+					str_c(key_item), str_len(key_item)); 
+
+				kctx = &key_ctx;
+				array_idx_set(&mctx->key_contexts, key_index, kctx); 
+			} else 
+				kctx = array_idx(&mctx->key_contexts, key_index);
+		}
 
 		if ( mtch->match
 			(mctx->match_type, mctx->comparator, value, strlen(value), 
-- 
GitLab