On Mon, 2010-09-20 at 10:58 -0300, Alex Baule wrote:
//first input, using the input full_input[0] = i_stream_create_header_filter(input, HEADER_FILTER_EXCLUDE | HEADER_FILTER_NO_CR, exclude_headers, 1, filter_callback, imail); // second input from another file. full_input[1] = i_stream_create_fd(fd1, 0, TRUE); // finish the input full_input[2] = NULL; // recreating the stream imail->data.stream = i_stream_create_concat(full_input); //unref the old one. i_stream_unref(&input);
i_stream_create_concat() also references the full_input[] streams, so you need to unreference them because you no longer need them:
i_stream_unref(&full_input[0]); i_stream_unref(&full_input[1]);
Sep 20 10:48:04 brc dovecot: imap(alex@exemplo.com.br): Panic: file index-mail.c: line 1150 (index_mail_close): assertion failed: (! mail->data.destroying_stream)
This anyway means that there is still a reference to the stream and it's getting leaked.