From 890fbb7314726f70dda5e7992e5de57338895aa0 Mon Sep 17 00:00:00 2001 From: Marco Bettini Date: Tue, 10 Jun 2025 09:34:33 +0000 Subject: [PATCH] lib-storage: mail_storage_create_list() - Remove moot tests for storage_class == NULL Found by coverity, 40008 Dereference before null check --- src/lib-storage/mail-storage.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib-storage/mail-storage.c b/src/lib-storage/mail-storage.c index 751e832502..03a1824d55 100644 --- a/src/lib-storage/mail-storage.c +++ b/src/lib-storage/mail-storage.c @@ -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"; -- 2.47.3