Btrfs: fix memory leaks on walking backrefs failure
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Tue, 28 Jan 2014 11:13:38 +0000 (19:13 +0800)
committerChris Mason <clm@fb.com>
Wed, 29 Jan 2014 15:06:26 +0000 (07:06 -0800)
When walking backrefs, we may iterate every inode's extent
and add/merge them into ulist, and the caller will free memory
from ulist.

However, if we fail to allocate inode's extents element
memory or ulist_add() fail to allocate memory, we won't
add allocated memory into ulist, and the caller won't
free some allocated memory thus memory leaks happen.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/backref.c

Simple merge