mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
Btrfs: fix memory leak in name_cache_insert()
We should free name_cache_entry before returning from the error handling code. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
This commit is contained in:
parent
57ba86c00f
commit
cfa7a9ccda
@ -1814,8 +1814,10 @@ static int name_cache_insert(struct send_ctx *sctx,
|
||||
(unsigned long)nce->ino);
|
||||
if (!nce_head) {
|
||||
nce_head = kmalloc(sizeof(*nce_head), GFP_NOFS);
|
||||
if (!nce_head)
|
||||
if (!nce_head) {
|
||||
kfree(nce);
|
||||
return -ENOMEM;
|
||||
}
|
||||
INIT_LIST_HEAD(nce_head);
|
||||
|
||||
ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head);
|
||||
|
Loading…
x
Reference in New Issue
Block a user