]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
submission: Allocate client on alloconly mempool.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 16 Sep 2018 19:15:20 +0000 (21:15 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 12 Feb 2019 13:40:54 +0000 (15:40 +0200)
src/submission/submission-client.c
src/submission/submission-client.h

index 1d80074e317e838c6919cbcc896dfc1086d79a37..bdda207f004e5803207d9b4b9f5179c055887e6c 100644 (file)
@@ -186,16 +186,19 @@ struct client *client_create(int fd_in, int fd_out,
        struct smtp_server_settings smtp_set;
        const char *ident;
        struct client *client;
+       pool_t pool;
 
        /* always use nonblocking I/O */
        net_set_nonblock(fd_in, TRUE);
        net_set_nonblock(fd_out, TRUE);
 
-       client = i_new(struct client, 1);
+       pool = pool_alloconly_create("submission client", 2048);
+       client = p_new(pool, struct client, 1);
+       client->pool = pool;
        client->user = user;
        client->service_user = service_user;
        client->set = set;
-       client->session_id = i_strdup(session_id);
+       client->session_id = p_strdup(pool, session_id);
 
        i_array_init(&client->rcpt_to, 8);
        i_array_init(&client->rcpt_backends, 8);
@@ -302,8 +305,7 @@ void client_destroy(struct client *client, const char *prefix,
 
        client_state_reset(client);
 
-       i_free(client->session_id);
-       i_free(client);
+       pool_unref(&client->pool);
 
        master_service_client_connection_destroyed(master_service);
        submission_refresh_proctitle();
index 71be61393b1c6643cb835661b161b20be9c6896d..a18b5d706a8d2baca847924cb0e881d89a7dd484 100644 (file)
@@ -17,7 +17,9 @@ struct client_state {
 
 struct client {
        struct client *prev, *next;
-       char *session_id;
+       pool_t pool;
+
+       const char *session_id;
 
        const struct setting_parser_info *user_set_info;
        const struct submission_settings *set;