]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Fixed crashes with dsync-server -U parameter
authorTimo Sirainen <tss@iki.fi>
Sun, 7 Apr 2013 22:56:25 +0000 (01:56 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 7 Apr 2013 22:56:25 +0000 (01:56 +0300)
src/doveadm/dsync/doveadm-dsync.c

index 1d524dff69128761f67c68052cf07887057babf0..ef2f702edf1b27ab495bf6bab1579d1b6b1d4385 100644 (file)
@@ -909,7 +909,7 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
        struct dsync_cmd_context *ctx = (struct dsync_cmd_context *)_ctx;
        struct dsync_ibc *ibc;
        struct dsync_brain *brain;
-       string_t *temp_prefix;
+       string_t *temp_prefix, *state_str = NULL;
 
        if (_ctx->conn != NULL) {
                /* doveadm-server connection. start with a success reply.
@@ -933,6 +933,11 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
 
        io_loop_run(current_ioloop);
 
+       if (ctx->replicator_notify) {
+               state_str = t_str_new(128);
+               dsync_brain_get_state(brain, state_str);
+       }
+
        if (dsync_brain_deinit(&brain) < 0)
                _ctx->exit_code = EX_TEMPFAIL;
        dsync_ibc_deinit(&ibc);
@@ -943,12 +948,8 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
                o_stream_close(_ctx->conn->output);
        }
 
-       if (ctx->replicator_notify) {
-               string_t *state_str = t_str_new(128);
-               dsync_brain_get_state(brain, state_str);
+       if (ctx->replicator_notify)
                dsync_replicator_notify(ctx, str_c(state_str));
-       }
-
        return _ctx->exit_code == 0 ? 0 : -1;
 }