keymap serialization: Fix unchecked allocation failures The previous commit enabled clang-tidy to detect some missing checks.