]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib-index: Fix dangling index->map pointer when fsck fails in mail_index_map_latest_f... main
authorAki Tuomi <aki.tuomi@open-xchange.com>
Sat, 18 Apr 2026 18:00:36 +0000 (21:00 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Apr 2026 11:16:47 +0000 (11:16 +0000)
commitaf65280b94df30f08769c8ca737e42fa638501b7
treec5836a521cc6b8b84bed1df7525da3396b895043
parent05f4ace6e85e5d66b6f473f8b806e6bca417e1b3
lib-index: Fix dangling index->map pointer when fsck fails in mail_index_map_latest_file()

If mail_index_fsck() returns -1 (e.g. log lock failure), index->map was
left pointing at new_map. The subsequent mail_index_unmap(&new_map) freed
that object, leaving index->map as a dangling pointer.

Fix by restoring index->map = old_map before breaking on fsck error,
mirroring what the success path already does.
src/lib-index/mail-index-map-read.c
src/lib-index/test-mail-index.c