]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: local: Allocate recipients on the default pool, rather than the client state...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 30 Oct 2017 01:00:38 +0000 (02:00 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Thu, 7 Dec 2017 23:09:47 +0000 (00:09 +0100)
This prevents the pool from growing potentially indefinitely with failed recipients.

src/lmtp/lmtp-local.c

index a1c18feae2ada1a3cb3da7ed99a4a33f2e6f4ec8..3e1b8384e7ffcda7f1ded29bf4a5b2f5e93f06dc 100644 (file)
@@ -31,9 +31,9 @@
 
 struct lmtp_local_recipient {
        struct lmtp_recipient rcpt;
-       const char *session_id;
+       char *session_id;
 
-       const char *detail;
+       char *detail;
 
        struct mail_storage_service_user *service_user;
        struct anvil_query *anvil_query;
@@ -126,6 +126,10 @@ void lmtp_local_rcpt_deinit(struct lmtp_local_recipient *rcpt)
                anvil_client_query_abort(anvil, &rcpt->anvil_query);
        lmtp_local_rcpt_anvil_disconnect(rcpt);
        mail_storage_service_user_unref(&rcpt->service_user);
+
+       i_free(rcpt->session_id);
+       i_free(rcpt->detail);
+       i_free(rcpt);
 }
 
 static void
@@ -322,13 +326,13 @@ int lmtp_local_rcpt(struct client *client,
        if (client->local == NULL)
                client->local = lmtp_local_init(client);
 
-       rcpt = p_new(client->state_pool, struct lmtp_local_recipient, 1);
+       rcpt = i_new(struct lmtp_local_recipient, 1);
        rcpt->rcpt.client = client;
        rcpt->rcpt.address = smtp_address_clone(client->state_pool, address); 
        smtp_params_rcpt_copy(client->state_pool, &rcpt->rcpt.params, params);
-       rcpt->detail = p_strdup(client->state_pool, detail);
+       rcpt->detail = i_strdup(detail);
        rcpt->service_user = service_user;
-       rcpt->session_id = p_strdup(client->state_pool, session_id);
+       rcpt->session_id = i_strdup(session_id);
 
        if (client->lmtp_set->lmtp_user_concurrency_limit == 0) {
                (void)lmtp_local_rcpt_anvil_finish(rcpt);