mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
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: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
parent
83dcf400be
commit
ec7478fa17
1 changed files with 2 additions and 1 deletions
|
@ -649,7 +649,8 @@ static void free_device(struct nandsim *ns)
|
|||
kmem_cache_free(ns->nand_pages_slab,
|
||||
ns->pages[i].byte);
|
||||
}
|
||||
kmem_cache_destroy(ns->nand_pages_slab);
|
||||
if (ns->nand_pages_slab)
|
||||
kmem_cache_destroy(ns->nand_pages_slab);
|
||||
vfree(ns->pages);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue