CVE-2022-50304 mtd: core: fix possible resource leak in init_mtd()