From f38dd2a62537b788bb92e99ed679eae074d5265c Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Tue, 15 Sep 2015 09:59:13 +0000 Subject: [PATCH] 6220 memleak in l2arc on debug build https://github.com/illumos/illumos-gate/commit/c546f36aa898d913ff77674fb5ff97f15b2e08b4 https://www.illumos.org/issues/6220 5408 introduced a memleak in l2arc, namely the member b_thawed gets leaked when an arc_hdr is realloced from full to l2only. Reviewed by: Saso Kiselkov Reviewed by: Simon Klinkert Reviewed by: George Wilson Approved by: Robert Mustacchi Author: Arne Jansen --- uts/common/fs/zfs/arc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/uts/common/fs/zfs/arc.c b/uts/common/fs/zfs/arc.c index b3afc4ff2b7..92e089e4b3d 100644 --- a/uts/common/fs/zfs/arc.c +++ b/uts/common/fs/zfs/arc.c @@ -1305,6 +1305,13 @@ arc_hdr_realloc(arc_buf_hdr_t *hdr, kmem_cache_t *old, kmem_cache_t *new) VERIFY(!HDR_L2_WRITING(hdr)); VERIFY3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL); +#ifdef ZFS_DEBUG + if (hdr->b_l1hdr.b_thawed != NULL) { + kmem_free(hdr->b_l1hdr.b_thawed, 1); + hdr->b_l1hdr.b_thawed = NULL; + } +#endif + nhdr->b_flags &= ~ARC_FLAG_HAS_L1HDR; } /*