On Fri, 2012-06-15 at 22:11 +0200, Daniel Parthey wrote:
> > mail02# doveadm -c /etc/dovecot-director/dovecot-director.conf search -u 
> > [email protected] all
..
> #3  doveadm_print_flow_print (value=0x64697567 <Address 0x64697567 out of 
> bounds>) at doveadm-print-flow.c:51
>         hdr = <value optimized out>
> #4  0x0000000000415667 in doveadm_print (value=0x1c28970 
> "67b3b72453278b4f6a3d000051abeb58") at doveadm-print.c:65
>         headers = 0x1c37120
> #5  0x000000000041638d in server_flush_field (conn=0x1c4ab10) at 
> server-connection.c:111
>         text = 0x0

Hmm. See if the attached patch fixes it?

diff -r a28c8043842d src/doveadm/doveadm-print.c
--- a/src/doveadm/doveadm-print.c	Sat Jun 16 02:03:53 2012 +0300
+++ b/src/doveadm/doveadm-print.c	Sat Jun 16 02:13:03 2012 +0300
@@ -18,6 +18,7 @@
 	const struct doveadm_print_vfuncs *v;
 
 	unsigned int header_idx;
+	bool print_stream_open;
 };
 
 static struct doveadm_print_context *ctx;
@@ -52,7 +53,7 @@
 	doveadm_print_header(key_title, key_title, 0);
 }
 
-void doveadm_print(const char *value)
+static void doveadm_print_sticky_headers(void)
 {
 	const struct doveadm_print_header_context *headers;
 	unsigned int count;
@@ -68,7 +69,13 @@
 			break;
 		}
 	}
+}
 
+void doveadm_print(const char *value)
+{
+	i_assert(!ctx->print_stream_open);
+
+	doveadm_print_sticky_headers();
 	ctx->v->print(value);
 	ctx->header_idx++;
 }
@@ -82,9 +89,15 @@
 
 void doveadm_print_stream(const void *value, size_t size)
 {
+	if (!ctx->print_stream_open) {
+		doveadm_print_sticky_headers();
+		ctx->print_stream_open = TRUE;
+	}
 	ctx->v->print_stream(value, size);
-	if (size == 0)
+	if (size == 0) {
 		ctx->header_idx++;
+		ctx->print_stream_open = FALSE;
+	}
 }
 
 void doveadm_print_sticky(const char *key, const char *value)

Reply via email to