summaryrefslogtreecommitdiffstats
path: root/lib/test_ida.c
diff options
context:
space:
mode:
authorWenwen Wang <wenwen@cs.uga.edu>2020-02-01 20:38:38 +0000
committerDavid Sterba <dsterba@suse.com>2020-02-12 17:16:31 +0100
commitf311ade3a7adf31658ed882aaab9f9879fdccef7 (patch)
tree40edbbbdf532325f49c77ff47b276bdf259994fa /lib/test_ida.c
parentd55966c4279bfc6a0cf0b32bf13f5df228a1eeb6 (diff)
downloadlinux-f311ade3a7adf31658ed882aaab9f9879fdccef7.tar.bz2
btrfs: ref-verify: fix memory leaks
In btrfs_ref_tree_mod(), 'ref' and 'ra' are allocated through kzalloc() and kmalloc(), respectively. In the following code, if an error occurs, the execution will be redirected to 'out' or 'out_unlock' and the function will be exited. However, on some of the paths, 'ref' and 'ra' are not deallocated, leading to memory leaks. For example, if 'action' is BTRFS_ADD_DELAYED_EXTENT, add_block_entry() will be invoked. If the return value indicates an error, the execution will be redirected to 'out'. But, 'ref' is not deallocated on this path, causing a memory leak. To fix the above issues, deallocate both 'ref' and 'ra' before exiting from the function when an error is encountered. CC: stable@vger.kernel.org # 4.15+ Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'lib/test_ida.c')
0 files changed, 0 insertions, 0 deletions