]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mdbox: Fix crash in storage destroy() with partially finished create()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 20 Dec 2024 08:35:39 +0000 (10:35 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:02 +0000 (10:40 +0200)
src/lib-storage/index/dbox-multi/mdbox-file.c
src/lib-storage/index/dbox-multi/mdbox-map.c

index a620717b79a309faef648429bbe792dad132e2ae..16c68818ceee3949b20b72a192f10e9a51d3b877 100644 (file)
@@ -43,6 +43,8 @@ void mdbox_files_free(struct mdbox_storage *storage)
        struct mdbox_file *const *files;
        unsigned int i, count;
 
+       if (!array_is_created(&storage->open_files))
+               return;
        files = array_get(&storage->open_files, &count);
        for (i = 0; i < count; i++)
                dbox_file_free(&files[i]->file);
index 0542f6642b24b1fe7795ee5d71dcc3c58b210664..e886d7f9e7fbeefce7cba5a3be28f21e891f327f 100644 (file)
@@ -93,6 +93,8 @@ void mdbox_map_deinit(struct mdbox_map **_map)
 {
        struct mdbox_map *map = *_map;
 
+       if (map == NULL)
+               return;
        *_map = NULL;
 
        mdbox_map_deinit_cleanup(map);