mtd: nandsim: fix free of NULL pointer