Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec7478fa authored by shengyong's avatar shengyong Committed by Brian Norris
Browse files

mtd: nandsim: fix free of NULL pointer



If allocating ns->nand_pages_slab fails, do not try to destroy it when
cleaning up nandsim resources.

Signed-off-by: default avatarSheng Yong <shengyong1@huawei.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 83dcf400
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -649,6 +649,7 @@ static void free_device(struct nandsim *ns)
				kmem_cache_free(ns->nand_pages_slab,
						ns->pages[i].byte);
		}
		if (ns->nand_pages_slab)
			kmem_cache_destroy(ns->nand_pages_slab);
		vfree(ns->pages);
	}