summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2012-12-17 07:38:51 +0100
committerJosef Bacik <josef@toxicpanda.com>2013-01-14 19:52:30 +0100
commitcfa7a9ccda711ac6ab8f0d17c3a9b540092d305a (patch)
tree639a5436c4efe846035864a92832f67f520debe3 /fs
parentRevert "Btrfs: reorder tree mod log operations in deleting a pointer" (diff)
downloadlinux-cfa7a9ccda711ac6ab8f0d17c3a9b540092d305a.tar.xz
linux-cfa7a9ccda711ac6ab8f0d17c3a9b540092d305a.zip
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')
-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 54454542ad40..321b7fb4e441 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);