changeset 15350:bb095315d025

Make static analyzer happier.
author Timo Sirainen <tss@iki.fi>
date Mon, 29 Oct 2012 20:48:08 +0200
parents 755b03fb6fce
children ce342fd3cae7
files src/director/director-connection.c src/director/director-test.c src/imap/cmd-urlfetch.c src/lib-imap-urlauth/imap-urlauth-fetch.c src/lib-index/mail-cache-transaction.c src/lib-index/mail-transaction-log.c src/lib-mail/message-parser.c
diffstat 7 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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);
 	}
 }
--- 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) {
--- 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);
--- 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)
--- 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;
 		}
 
--- 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;