From d960beca61b3c5ede8eb595ceb091666e0d4a17c Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 26 Apr 2023 08:43:39 -0700
Subject: [PATCH] zdb: Fix minor memory leak

Commit 6b6aaf6dc2e65c63c74fbd7840c14627e9a91ce2 introduced a small
memory leak in zdb.  This was detected by the LeakSanitizer and was
causing all ztest runs to fail.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #14796
---
 cmd/zdb/zdb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 64ec3eb002..ec5d1acacf 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -6940,6 +6940,8 @@ dump_block_stats(spa_t *spa)
 		if (dump_opt['b'] >= 2) {
 			dump_size_histograms(zcb);
 		}
+
+		umem_free(mdstats, sizeof (zfs_blkstat_t));
 	}
 
 	(void) printf("\n");