]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Add doveadm_cmd_context.pool
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 1 Jun 2022 08:04:09 +0000 (11:04 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 1 Jun 2022 08:13:29 +0000 (08:13 +0000)
src/doveadm/client-connection-http.c
src/doveadm/client-connection-tcp.c
src/doveadm/doveadm-cmd.h
src/doveadm/doveadm.c

index 572e3b938d088bf7834ce7ac6411a6227dcd222f..31e37310082139b23883ab41bdbf91b3a012228c 100644 (file)
@@ -195,6 +195,7 @@ doveadm_http_server_command_execute(struct client_request_http *req)
 
        prev_ioloop = current_ioloop;
        i_zero(&cctx);
+       cctx.pool = pool_alloconly_create("doveadm cmd", 256);
        cctx.conn_type = conn->conn.type;
        cctx.input = req->input;
        cctx.output = req->output;
@@ -255,6 +256,7 @@ doveadm_http_server_command_execute(struct client_request_http *req)
                doveadm_http_server_json_success(req, is);
        }
        i_stream_unref(&is);
+       pool_unref(&cctx.pool);
 }
 
 static int
index 06e759cb82619d95474a8d06a280dd8ebf556579..3763f0ae8c24ed36ea41164c9e1e9e91abe20a2c 100644 (file)
@@ -330,6 +330,7 @@ static bool client_handle_command(struct client_connection_tcp *conn,
        struct doveadm_cmd_context cctx;
 
        i_zero(&cctx);
+       cctx.pool = pool_alloconly_create("doveadm cmd", 256);
        cctx.conn_type = conn->conn.type;
        cctx.input = conn->input;
        cctx.output = conn->output;
@@ -337,7 +338,9 @@ static bool client_handle_command(struct client_connection_tcp *conn,
        cctx.remote_ip = conn->conn.remote_ip;
        cctx.local_port = conn->conn.local_port;
        cctx.remote_port = conn->conn.remote_port;
-       return client_handle_command_ctx(conn, &cctx, args);
+       bool ret = client_handle_command_ctx(conn, &cctx, args);
+       pool_unref(&cctx.pool);
+       return ret;
 }
 
 static int
index d29ebd9c92e9af6d10ad2d434f5be4f42e342393..8bbb55c723e232e9f6209591452974f063906560 100644 (file)
@@ -71,6 +71,7 @@ struct doveadm_cmd_ver2 {
 struct doveadm_cmd_context {
        const struct doveadm_cmd_ver2 *cmd; /* for help */
 
+       pool_t pool;
        int argc;
        const struct doveadm_cmd_param *argv;
 
index 8b30762b83c94669cfe45f3953f82dbc45d02c99..3aa7ab65e790b19f1bcdeceff70fe4c048fe7770 100644 (file)
@@ -265,6 +265,7 @@ int main(int argc, char *argv[])
        int c;
 
        i_zero(&cctx);
+       cctx.pool = pool_alloconly_create("doveadm cmd", 256);
        cctx.conn_type = DOVEADM_CONNECTION_TYPE_CLI;
 
        i_set_failure_exit_callback(failure_exit_callback);
@@ -371,6 +372,7 @@ int main(int argc, char *argv[])
        }
        if (cctx.referral != NULL)
                i_fatal("Command requested referral: %s", cctx.referral);
+       pool_unref(&cctx.pool);
 
        if (!quick_init) {
                doveadm_mail_deinit();