aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorAlexander Block <ablock84@googlemail.com>2012-08-01 06:07:43 -0400
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:18:56 -0400
commit5dc67d0ba915cda01ed3a980502945edf2c46b70 (patch)
tree667aabdf4a246bd45de00b7d2ca298732d11f3c3 /fs/btrfs/send.c
parent3e126f32f88095ad1bd01b3c451e52aa9094f45c (diff)
Btrfs: free nce and nce_head on error in name_cache_insert
Both were leaked in case of error. Reported-by: Alex Lyakas <alex.bolshoy.btrfs@gmail.com> Signed-off-by: Alexander Block <ablock84@googlemail.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index b0f9df30f24d..cfbe987f854b 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1759,6 +1759,7 @@ out:
1759 * Insert a name cache entry. On 32bit kernels the radix tree index is 32bit, 1759 * Insert a name cache entry. On 32bit kernels the radix tree index is 32bit,
1760 * so we need to do some special handling in case we have clashes. This function 1760 * so we need to do some special handling in case we have clashes. This function
1761 * takes care of this with the help of name_cache_entry::radix_list. 1761 * takes care of this with the help of name_cache_entry::radix_list.
1762 * In case of error, nce is kfreed.
1762 */ 1763 */
1763static int name_cache_insert(struct send_ctx *sctx, 1764static int name_cache_insert(struct send_ctx *sctx,
1764 struct name_cache_entry *nce) 1765 struct name_cache_entry *nce)
@@ -1775,8 +1776,11 @@ static int name_cache_insert(struct send_ctx *sctx,
1775 INIT_LIST_HEAD(nce_head); 1776 INIT_LIST_HEAD(nce_head);
1776 1777
1777 ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head); 1778 ret = radix_tree_insert(&sctx->name_cache, nce->ino, nce_head);
1778 if (ret < 0) 1779 if (ret < 0) {
1780 kfree(nce_head);
1781 kfree(nce);
1779 return ret; 1782 return ret;
1783 }
1780 } 1784 }
1781 list_add_tail(&nce->radix_list, nce_head); 1785 list_add_tail(&nce->radix_list, nce_head);
1782 list_add_tail(&nce->list, &sctx->name_cache_list); 1786 list_add_tail(&nce->list, &sctx->name_cache_list);