]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix memory leak for last error's mailbox
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 11 Oct 2022 08:42:28 +0000 (11:42 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 11 Oct 2022 08:42:28 +0000 (11:42 +0300)
Broken by 0a09f7321f00253dfacd87453462e6c43ea926bf

src/lib-storage/mail-storage.c

index f1f68b9d35016b7e35b07e17bc220c97fcbfb2b5..4f9daff2d514121d57e170d30ea2c43f57083a11 100644 (file)
@@ -505,8 +505,7 @@ void mail_storage_unref(struct mail_storage **_storage)
        DLLIST_REMOVE(&storage->user->storages, storage);
 
        storage->v.destroy(storage);
-       i_free(storage->last_internal_error);
-       i_free(storage->error_string);
+       mail_storage_clear_error(storage);
        if (array_is_created(&storage->error_stack)) {
                i_assert(array_count(&storage->error_stack) == 0);
                array_free(&storage->error_stack);
@@ -544,6 +543,7 @@ void mail_storage_clear_error(struct mail_storage *storage)
        i_free_and_null(storage->error_string);
 
        i_free(storage->last_internal_error);
+       i_free(storage->last_internal_error_mailbox);
        storage->last_error_is_internal = FALSE;
        storage->error = MAIL_ERROR_NONE;
 }