HomeFreeBSD

Fix 0 byte memory leak in zfs receive

Description

Fix 0 byte memory leak in zfs receive

Currently, when a DRR_OBJECT record is read into memory in
receive_read_record(), memory is allocated for the bonus buffer.
However, if the object doesn't have a bonus buffer the code will
still "allocate" the zero bytes, but the memory will not be passed
to the processing thread for cleanup later. This causes the spl
kmem tracking code to report a leak. This patch simply changes the
code so that it only allocates this memory if it has a non-zero
length.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #8266

Details

Provenance
Tom Caputi <tcaputi@datto.com>Authored on Jan 18 2019, 7:06 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jan 18 2019, 7:06 PM
Parents
rG1a759200e5aa: Document guidelines for usage of zfs_dbgmsg
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG960347d3a684: Fix 0 byte memory leak in zfs receive (authored by Tom Caputi <tcaputi@datto.com>).Jan 18 2019, 7:06 PM