From 62d014a5e9676c872eb4183c47b3c4c5c622a538 Mon Sep 17 00:00:00 2001 From: Marco Bettini Date: Tue, 15 Jul 2025 08:09:09 +0000 Subject: [PATCH] lib-storage: Make mailbox_tree_deinit() and mailbox_tree_iterate_deinit() no-ops on NULLs --- src/lib-storage/mailbox-tree.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib-storage/mailbox-tree.c b/src/lib-storage/mailbox-tree.c index 7e292f950c..94945aeae3 100644 --- a/src/lib-storage/mailbox-tree.c +++ b/src/lib-storage/mailbox-tree.c @@ -52,6 +52,8 @@ void mailbox_tree_deinit(struct mailbox_tree_context **_tree) struct mailbox_tree_context *tree = *_tree; *_tree = NULL; + if (tree == NULL) + return; pool_unref(&tree->pool); i_free(tree); } @@ -260,6 +262,8 @@ void mailbox_tree_iterate_deinit(struct mailbox_tree_iterate_context **_ctx) struct mailbox_tree_iterate_context *ctx = *_ctx; *_ctx = NULL; + if (ctx == NULL) + return; str_free(&ctx->path_str); array_free(&ctx->node_path); i_free(ctx); -- 2.47.3