]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail_storage_create_list() - Remove moot tests for storage_class ==...
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 10 Jun 2025 09:34:33 +0000 (09:34 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Fri, 27 Jun 2025 13:54:52 +0000 (13:54 +0000)
Found by coverity, 40008 Dereference before null check

src/lib-storage/mail-storage.c

index 751e8325028a3dafec551a38978ad6497f33b5e8..03a1824d5569b5c4787cc7782ff6cb4611a8ff7b 100644 (file)
@@ -413,11 +413,9 @@ mail_storage_create_list(struct mail_namespace *ns,
 
        if (mail_set->mail_path[0] == '\0') {
                /* no root directory given. is this allowed? */
-               if (storage_class == NULL &&
-                   (flags & MAIL_STORAGE_FLAG_NO_AUTODETECTION) == 0) {
+               if ((flags & MAIL_STORAGE_FLAG_NO_AUTODETECTION) == 0) {
                        /* autodetection should take care of this */
-               } else if (storage_class != NULL &&
-                          (storage_class->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) != 0) {
+               } else if ((storage_class->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) != 0) {
                        /* root not required for this storage */
                } else {
                        *error_r = "Root mail directory not given";