dovecot-2.2: Make static analyzer happier.

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 20:48:38 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/bb095315d025
changeset: 15350:bb095315d025
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 29 20:48:08 2012 +0200
description:
Make static analyzer happier.

diffstat:

 src/director/director-connection.c        |  2 +-
 src/director/director-test.c              |  1 +
 src/imap/cmd-urlfetch.c                   |  4 ++--
 src/lib-imap-urlauth/imap-urlauth-fetch.c |  3 +--
 src/lib-index/mail-cache-transaction.c    |  1 +
 src/lib-index/mail-transaction-log.c      |  2 +-
 src/lib-mail/message-parser.c             |  6 ++++--
 7 files changed, 11 insertions(+), 8 deletions(-)

diffs (104 lines):

diff -r 755b03fb6fce -r bb095315d025 src/director/director-connection.c
--- a/src/director/director-connection.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/director/director-connection.c	Mon Oct 29 20:48:08 2012 +0200
@@ -708,11 +708,11 @@
 		   ourself. */
 		*host_r = NULL;
 	} else {
+		*host_r = host;
 		if (seq <= host->last_seq) {
 			/* already seen this */
 			return 1;
 		}
-		*host_r = host;
 		host->last_seq = seq;
 	}
 	return 0;
diff -r 755b03fb6fce -r bb095315d025 src/director/director-test.c
--- a/src/director/director-test.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/director/director-test.c	Mon Oct 29 20:48:08 2012 +0200
@@ -526,6 +526,7 @@
 			i_assert(conn != NULL);
 			i++;
 		}
+		i_assert(conn != NULL);
 		director_connection_destroy(&conn);
 	}
 }
diff -r 755b03fb6fce -r bb095315d025 src/imap/cmd-urlfetch.c
--- a/src/imap/cmd-urlfetch.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/imap/cmd-urlfetch.c	Mon Oct 29 20:48:08 2012 +0200
@@ -72,7 +72,7 @@
 	struct client *client = cmd->client;
 	struct cmd_urlfetch_context *ctx =
 		(struct cmd_urlfetch_context *)cmd->context;
-	int ret = 1;
+	int ret;
 
 	/* are we in the middle of an urlfetch literal? */
 	if (ctx->input == NULL)
@@ -87,7 +87,7 @@
 
 	/* transfer literal to client */
 	o_stream_set_max_buffer_size(client->output, 0);
-	ret = o_stream_send_istream(client->output, ctx->input);
+	(void)o_stream_send_istream(client->output, ctx->input);
 	o_stream_set_max_buffer_size(client->output, (size_t)-1);
 
 	if (ctx->input->v_offset == ctx->size) {
diff -r 755b03fb6fce -r bb095315d025 src/lib-imap-urlauth/imap-urlauth-fetch.c
--- a/src/lib-imap-urlauth/imap-urlauth-fetch.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c	Mon Oct 29 20:48:08 2012 +0200
@@ -198,8 +198,7 @@
 	}
 
 	/* if requested, read the message part the URL points to */
-	mpresult.size = 0;
-	mpresult.input = NULL;
+	memset(&mpresult, 0, sizeof(mpresult));
 	if (success && ((url_flags & IMAP_URLAUTH_FETCH_FLAG_BODY) != 0 ||
 			(url_flags & IMAP_URLAUTH_FETCH_FLAG_BINARY) != 0)) {
 		ret = imap_msgpart_url_read_part(mpurl, &mpresult, &error);
diff -r 755b03fb6fce -r bb095315d025 src/lib-index/mail-cache-transaction.c
--- a/src/lib-index/mail-cache-transaction.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/lib-index/mail-cache-transaction.c	Mon Oct 29 20:48:08 2012 +0200
@@ -335,6 +335,7 @@
 		return -1;
 
 	/* first write the actual data to cache file */
+	i_assert(ctx->cache_data != NULL);
 	i_assert(ctx->last_rec_pos <= ctx->cache_data->used);
 	if (mail_cache_append(ctx->cache, ctx->cache_data->data,
 			      ctx->last_rec_pos, &write_offset) < 0)
diff -r 755b03fb6fce -r bb095315d025 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/lib-index/mail-transaction-log.c	Mon Oct 29 20:48:08 2012 +0200
@@ -452,7 +452,7 @@
 
 		if (ret == 0 && log->head == file) {
 			/* success */
-			lock_secs = file->lock_created - lock_wait_started;
+			lock_secs = log->head->lock_created - lock_wait_started;
 			break;
 		}
 
diff -r 755b03fb6fce -r bb095315d025 src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Mon Oct 29 20:45:41 2012 +0200
+++ b/src/lib-mail/message-parser.c	Mon Oct 29 20:48:08 2012 +0200
@@ -690,12 +690,14 @@
 static int preparsed_parse_prologue_more(struct message_parser_ctx *ctx,
 					 struct message_block *block_r)
 {
-	uoff_t end_offset = ctx->part->children->physical_pos;
-	uoff_t boundary_min_start;
+	uoff_t boundary_min_start, end_offset;
 	const unsigned char *cur;
 	bool full;
 	int ret;
 
+	i_assert(ctx->part->children != NULL);
+	end_offset = ctx->part->children->physical_pos;
+
 	if ((ret = message_parser_read_more(ctx, block_r, &full)) <= 0)
 		return ret;
 


More information about the dovecot-cvs mailing list