]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Add asserts to make scan-build happy
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 16 Jan 2025 11:14:35 +0000 (13:14 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:02 +0000 (10:40 +0200)
src/auth/db-ldap.c
src/config/config-parser.c
src/lib-sql/driver-cassandra.c
src/plugins/fts/fts-build-mail.c

index cb70e6d6c5c9ec66dc8a9ac767b0749d63d382f4..d12a1575e0aa519ca780d63826a6208d88558b59 100644 (file)
@@ -1416,6 +1416,7 @@ db_ldap_result_finish_debug(struct db_ldap_result_iterate_context *ctx)
        if (ctx->ldap_request->result_logged)
                return;
 
+       i_assert(ctx->debug != NULL);
        orig_len = str_len(ctx->debug);
        if (orig_len == 0) {
                e_debug(authdb_event(ctx->ldap_request->auth_request),
index 4b4fd476cb596a0c56f58cfde2ca022bede0572a..cdf60e882579a6cad51c5c63c3bdc1d07c53dceb 100644 (file)
@@ -747,8 +747,10 @@ config_apply_exact_line(struct config_parser_context *ctx,
        for (; config_key != NULL; config_key = config_key->next) {
                struct config_module_parser *l =
                        &ctx->cur_section->filter_parser->module_parsers[config_key->info_idx];
-               if (l->settings == NULL)
+               if (l->settings == NULL) {
                        config_module_parser_init(ctx, l);
+                       i_assert(l->settings != NULL);
+               }
                switch (l->info->defines[config_key->define_idx].type) {
                case SET_STRLIST:
                        if (config_apply_strlist(ctx, key, value, config_key,
@@ -953,10 +955,10 @@ again:
        /* the only '/' left should be if key is under list/ */
        key = key_with_path;
 
-       if (ctx->cur_section->filter_parser->filter.filter_name != NULL &&
-           ctx->cur_section->filter_parser->filter.filter_name_array) {
+       if (ctx->cur_section->filter_parser->filter.filter_name_array) {
                /* For named list filters, try filter name { key } ->
                   filter_name_key first before anything else. */
+               i_assert(ctx->cur_section->filter_parser->filter.filter_name != NULL);
                const char *filter_key = filter_key_skip_group_prefix(
                        t_str_replace(ctx->cur_section->filter_parser->filter.filter_name, '/', '_'));
                const char *key2 = t_strdup_printf("%s_%s", filter_key, key);
@@ -2662,6 +2664,8 @@ void config_parser_apply_line(struct config_parser_context *ctx,
                                                           filter_key, key);
                        if (config_key_can_autoprefix(ctx, key2))
                                key = key2;
+               } else {
+                       i_assert(!cur_filter->filter_name_array);
                }
 
                ctx->cur_section = config_add_new_section(ctx);
index a5dabb0c81c47b1b53d5b55342002f1030329b17..21284d6d6233d55b5f2f76e2c4bca6247261d712 100644 (file)
@@ -946,6 +946,8 @@ static int driver_cassandra_init_ssl(struct cassandra_db *db, const char **error
        struct settings_file file;
        CassError c_err;
 
+       i_assert(ssl_set != NULL);
+
        db->ssl = cass_ssl_new();
        i_assert(db->ssl != NULL);
 
index ad133a5323eff0faa3da6185b07af72b659b9bef..e0eb56463775a1142da250317c1a45e4811fbee5 100644 (file)
@@ -341,6 +341,8 @@ fts_build_tokenized(struct fts_mail_build_context *ctx,
        const struct language *lang;
        int ret;
 
+       i_assert(ctx->pending_input != NULL);
+
        if (ctx->cur_user_lang != NULL) {
                /* we already have a language */
        } else if ((ret = fts_detect_language(ctx, data, size, last, &lang)) < 0) {