]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix memory leak of pending_snapshot->inherit
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 7 Feb 2013 06:02:44 +0000 (06:02 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Wed, 20 Feb 2013 17:59:41 +0000 (12:59 -0500)
commit5e494619dc51ee3f3de217ab93601deddf9ef286
tree856777de858d660b2d1c8c38facd5197407ba668
parentdb30f48d5ce743c765523dbbaf99f7d3c05c2edc
Btrfs: fix memory leak of pending_snapshot->inherit

The argument "inherit" of btrfs_ioctl_snap_create_transid() was assigned
to NULL during we created the snapshots, so we didn't free it though we
called kfree() in the caller.

But since we are sure the snapshot creation is done after the function -
btrfs_ioctl_snap_create_transid() - completes, it is safe that we don't
assign the pointer "inherit" to NULL, and just free it in the caller of
btrfs_ioctl_snap_create_transid(). In this way, the code can become more
readable.

Reported-by: Alex Lyakas <alex.btrfs@zadarastorage.com>
Cc: Arne Jansen <sensille@gmx.net>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ioctl.c