summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2012-12-17 06:38:51 +0000
committerJosef Bacik <josef@toxicpanda.com>2013-01-14 13:52:30 -0500
commitcfa7a9ccda711ac6ab8f0d17c3a9b540092d305a (patch)
tree639a5436c4efe846035864a92832f67f520debe3 /fs/btrfs
parent57ba86c00f9573b63b8c06810d4f6915efed2442 (diff)
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>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/send.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 54454542ad4..321b7fb4e44 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -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);