grub2/grub-core/fs/zfs
Paulo Flabiano Smorigo 89bdab9658 zfs: Fix resource leaks while constructing path
There are several exit points in dnode_get_path() that are causing possible
memory leaks.

In the while(1) the correct exit mechanism should not be to do a direct return,
but to instead break out of the loop, setting err first if it is not already set.

The reason behind this is that the dnode_path is a linked list, and while doing
through this loop, it is being allocated and built up - the only way to
correctly unravel it is to traverse it, which is what is being done at the end
of the function outside of the loop.

Several of the existing exit points correctly did a break, but not all so this
change makes that more consistent and should resolve the leaking of memory as
found by Coverity.

Fixes: CID 73741

Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2021-03-02 15:54:16 +01:00
..
zfs_fletcher.c Update GPL for ZFS code to version 3, move copyright lines for Vladimir and me to FSF (covered by our assignments) 2010-12-01 22:55:26 +01:00
zfs_lz4.c zfs: remove size_t typedef and use grub_size_t instead 2017-08-07 16:21:15 +02:00
zfs_lzjb.c Update GPL for ZFS code to version 3, move copyright lines for Vladimir and me to FSF (covered by our assignments) 2010-12-01 22:55:26 +01:00
zfs_sha256.c * conf/Makefile.common (CFLAGS_GNULIB): Add 2012-02-24 12:30:32 +01:00
zfs.c zfs: Fix resource leaks while constructing path 2021-03-02 15:54:16 +01:00
zfscrypt.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
zfsinfo.c grub-core/fs/zfs/zfsinfo.c: memory leak in print_vdev_info 2014-12-01 20:54:12 +03:00