Fix a memory leak about cpu_mce and cpu_map

There is a memory leak if a lot of MCEs are assigned to same CPU with mce_flags set with MCE_HOLD. Current implementation will directly replace cpu_mce[cpu_idex] with new-coming mce without freeing old mce memory.
This patch fixes this memory leak issue, as well as adds a cleanup of dynamically allocated memory when program ends up.

Signed-off-by: Haicheng Li <>
Acked-by: Huang Ying <>
3 files changed