]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Make config_export_free() public and use it for aborting export
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 28 Mar 2023 00:10:06 +0000 (03:10 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Nov 2023 12:20:55 +0000 (14:20 +0200)
src/config/config-dump-full.c
src/config/config-request.c
src/config/config-request.h

index c96ce838b50f480f4e14cd3e91ce8e29b6a27ecc..190d2528ccb284987d3cbdb74108c1578413f63b 100644 (file)
@@ -198,7 +198,7 @@ int config_dump_full(enum config_dump_full_dest dest,
                fd = safe_mkstemp(path, 0700, (uid_t)-1, (gid_t)-1);
                if (fd == -1) {
                        i_error("safe_mkstemp(%s) failed: %m", str_c(path));
-                       (void)config_export_all_parsers(&export_ctx, &section_idx);
+                       config_export_free(&export_ctx);
                        str_free(&dump_ctx.delayed_output);
                        return -1;
                }
index 1b5cd644daaa88595cae109af10acc137a393d5a..5898d6e107081deec888c47e01415b0600617277 100644 (file)
@@ -459,8 +459,12 @@ const char *config_export_get_base_dir(struct config_export_context *ctx)
        i_unreached();
 }
 
-static void config_export_free(struct config_export_context *ctx)
+void config_export_free(struct config_export_context **_ctx)
 {
+       struct config_export_context *ctx = *_ctx;
+
+       *_ctx = NULL;
+
        if (ctx->dup_parsers != NULL)
                config_filter_parsers_free(ctx->dup_parsers);
        hash_table_destroy(&ctx->keys);
@@ -479,7 +483,7 @@ int config_export_all_parsers(struct config_export_context **_ctx,
        *_ctx = NULL;
 
        if (ctx->failed) {
-               config_export_free(ctx);
+               config_export_free(&ctx);
                return -1;
        }
 
@@ -509,6 +513,6 @@ int config_export_all_parsers(struct config_export_context **_ctx,
                }
        }
        *section_idx = ctx->section_idx;
-       config_export_free(ctx);
+       config_export_free(&ctx);
        return ret;
 }
index c08606806406da23a75703bea55d70a8208ba9b1..238e81ca3a0b9f87399185013c352b921444e754 100644 (file)
@@ -55,5 +55,6 @@ config_export_get_import_environment(struct config_export_context *ctx);
 const char *config_export_get_base_dir(struct config_export_context *ctx);
 int config_export_all_parsers(struct config_export_context **ctx,
                              unsigned int *section_idx);
+void config_export_free(struct config_export_context **ctx);
 
 #endif