NOR/CFI: fix memory leak; check malloc return value