]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Memory leak fixes on handling some RCPT TO failures.
authorTimo Sirainen <tss@iki.fi>
Tue, 8 Dec 2015 08:17:10 +0000 (10:17 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 8 Dec 2015 08:17:10 +0000 (10:17 +0200)
src/lmtp/commands.c

index aca1edd8983f53943268d1f0b0cbf51118ded40e..f36e076d91a65fa44cc415fb23ae77c5e66bea0e 100644 (file)
@@ -686,6 +686,7 @@ int cmd_rcpt(struct client *client, const char *args)
                client_send_line(client, "451 4.3.0 <%s> "
                        "Can't handle mixed proxy/non-proxy destinations",
                        address);
+               mail_storage_service_user_free(&rcpt->service_user);
                return 0;
        }
 
@@ -693,15 +694,16 @@ int cmd_rcpt(struct client *client, const char *args)
 
        rcpt->address = p_strdup(client->state_pool, address);
        rcpt->detail = p_strdup(client->state_pool, detail);
-       if ((ret = lmtp_rcpt_to_is_over_quota(client, rcpt)) < 0) {
-               client_send_line(client, ERRSTR_TEMP_MAILBOX_FAIL,
-                                rcpt->address);
+       if ((ret = lmtp_rcpt_to_is_over_quota(client, rcpt)) != 0) {
+               if (ret < 0) {
+                       client_send_line(client, ERRSTR_TEMP_MAILBOX_FAIL,
+                                        rcpt->address);
+               }
+               mail_storage_service_user_free(&rcpt->service_user);
                return 0;
        }
-       if (ret == 0) {
-               array_append(&client->state.rcpt_to, &rcpt, 1);
-               client_send_line(client, "250 2.1.5 OK");
-       }
+       array_append(&client->state.rcpt_to, &rcpt, 1);
+       client_send_line(client, "250 2.1.5 OK");
 
        if (client->lmtp_set->lmtp_user_concurrency_limit > 0) {
                const char *query = t_strconcat("LOOKUP\t",