dovecot-2.2: Make static analyzer happier.

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 7 21:47:15 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/06b884831f25
changeset: 19121:06b884831f25
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 08 00:46:11 2015 +0300
description:
Make static analyzer happier.

diffstat:

 src/config/config-request.c                 |  5 +++--
 src/lib-storage/mail-search-args-simplify.c |  1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r 9fdbb3b220ec -r 06b884831f25 src/config/config-request.c
--- a/src/config/config-request.c	Tue Sep 08 00:34:14 2015 +0300
+++ b/src/config/config-request.c	Tue Sep 08 00:46:11 2015 +0300
@@ -206,7 +206,7 @@
 {
 	const struct setting_define *def;
 	const void *value, *default_value, *change_value;
-	void *const *children = NULL, *const *change_children = NULL;
+	void *const *children, *const *change_children = NULL;
 	unsigned int i, count, count2, prefix_len;
 	const char *str;
 	char *key;
@@ -244,7 +244,7 @@
 		}
 
 		dump = FALSE;
-		count = 0;
+		count = 0; children = NULL;
 		str_truncate(ctx->value, 0);
 		switch (def->type) {
 		case SET_BOOL:
@@ -333,6 +333,7 @@
 			}
 		}
 
+		i_assert(count == 0 || children != NULL);
 		prefix_len = str_len(ctx->prefix);
 		for (i = 0; i < count; i++) {
 			str_append(ctx->prefix, def->key);
diff -r 9fdbb3b220ec -r 06b884831f25 src/lib-storage/mail-search-args-simplify.c
--- a/src/lib-storage/mail-search-args-simplify.c	Tue Sep 08 00:34:14 2015 +0300
+++ b/src/lib-storage/mail-search-args-simplify.c	Tue Sep 08 00:46:11 2015 +0300
@@ -346,6 +346,7 @@
 			break;
 		}
 		if (merged) {
+			i_assert(prev_arg != NULL);
 			prev_arg->next = args->next;
 			args = args->next;
 			ctx.removals = TRUE;


More information about the dovecot-cvs mailing list