]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Add data stack frames to [service] user initialization
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 22 Sep 2021 09:48:18 +0000 (12:48 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 22 Sep 2021 11:11:23 +0000 (11:11 +0000)
Initialization steps can use a lot of data stack, so try to free it at
several checkpoints.

src/lib-storage/mail-storage-service.c

index f6bd9bbe4956dedb37f5e3a8802d31a3e092f7a9..1dd30bbc4ad1071487f5dbcd77e471a118346909 100644 (file)
@@ -671,6 +671,7 @@ mail_storage_service_init_post(struct mail_storage_service_ctx *ctx,
        const char *home = priv->home;
        struct mail_user_connection_data conn_data;
        struct mail_user *mail_user;
+       int ret;
 
        i_zero(&conn_data);
        conn_data.local_ip = &user->input.local_ip;
@@ -764,7 +765,10 @@ mail_storage_service_init_post(struct mail_storage_service_ctx *ctx,
                }
        }
 
-       if (mail_user_init(mail_user, error_r) < 0) {
+       T_BEGIN {
+               ret = mail_user_init(mail_user, error_r);
+       } T_END_PASS_STR_IF(ret < 0, error_r);
+       if (ret < 0) {
                mail_user_unref(&mail_user);
                return -1;
        }
@@ -1444,8 +1448,10 @@ int mail_storage_service_lookup(struct mail_storage_service_ctx *ctx,
                update_log_prefix = FALSE;
        }
 
-       ret = mail_storage_service_lookup_real(ctx, input, update_log_prefix,
-                                              user_r, error_r);
+       T_BEGIN {
+               ret = mail_storage_service_lookup_real(ctx, input,
+                               update_log_prefix, user_r, error_r);
+       } T_END_PASS_STR_IF(ret < 0, error_r);
        i_set_failure_prefix("%s", old_log_prefix);
        i_free(old_log_prefix);
        return ret;
@@ -1581,9 +1587,11 @@ int mail_storage_service_next_with_session_suffix(struct mail_storage_service_ct
        mail_storage_service_set_log_prefix(ctx, user->user_set, user,
                                            &user->input, NULL);
        i_set_failure_prefix("%s", old_log_prefix);
-       ret = mail_storage_service_next_real(ctx, user,
-                                            session_id_suffix,
-                                            mail_user_r, error_r);
+       T_BEGIN {
+               ret = mail_storage_service_next_real(ctx, user,
+                                                    session_id_suffix,
+                                                    mail_user_r, error_r);
+       } T_END_PASS_STR_IF(ret < 0, error_r);
        if ((user->flags & MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT) != 0)
                i_set_failure_prefix("%s", old_log_prefix);
        i_free(old_log_prefix);