]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: xml2text - Move lib_init()/deinit() to surround event_create() and unref()
authorMarco Bettini <marco.bettini@open-xchange.com>
Thu, 13 Feb 2025 09:13:34 +0000 (09:13 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 20 Feb 2025 13:57:08 +0000 (13:57 +0000)
Otherwise we crash at 23: .event = event_create(NULL)

src/plugins/fts/xml2text.c

index 6894e28d1f38cabef141089a1344b29bc7dc4a48..c7f77220c1b76c94c4631c4c9efbd12d1aec8b1d 100644 (file)
@@ -17,6 +17,7 @@ int main(void)
        struct message_block block;
        ssize_t ret;
 
+       lib_init();
        struct fts_parser_context parser_context = {
                .content_type = "text/html",
                .event = event_create(NULL)
@@ -24,8 +25,6 @@ int main(void)
        event_add_category(parser_context.event, &event_category_fts);
        event_set_append_log_prefix(parser_context.event, "fts-xml2text: ");
 
-       lib_init();
-
        parser = fts_parser_html.try_init(&parser_context);
        i_assert(parser != NULL);
 
@@ -49,7 +48,7 @@ int main(void)
                        i_fatal("write(stdout) failed: %m");
        }
 
-       lib_deinit();
        event_unref(&parser_context.event);
+       lib_deinit();
        return 0;
 }