Fix memory leak in zil_parse().

482da24e2 missed arc_buf_destroy() calls on log parse errors, possibly
leaking up to 128KB of memory per dataset during ZIL replay.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #14987
This commit is contained in:
Alexander Motin 2023-06-17 22:51:37 -04:00 committed by GitHub
parent 10e36e1761
commit 8e8acabdca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -522,12 +522,16 @@ zil_parse(zilog_t *zilog, zil_parse_blk_func_t *parse_blk_func,
lr_t *lr = (lr_t *)lrp; lr_t *lr = (lr_t *)lrp;
reclen = lr->lrc_reclen; reclen = lr->lrc_reclen;
ASSERT3U(reclen, >=, sizeof (lr_t)); ASSERT3U(reclen, >=, sizeof (lr_t));
if (lr->lrc_seq > claim_lr_seq) if (lr->lrc_seq > claim_lr_seq) {
arc_buf_destroy(abuf, &abuf);
goto done; goto done;
}
error = parse_lr_func(zilog, lr, arg, txg); error = parse_lr_func(zilog, lr, arg, txg);
if (error != 0) if (error != 0) {
arc_buf_destroy(abuf, &abuf);
goto done; goto done;
}
ASSERT3U(max_lr_seq, <, lr->lrc_seq); ASSERT3U(max_lr_seq, <, lr->lrc_seq);
max_lr_seq = lr->lrc_seq; max_lr_seq = lr->lrc_seq;
lr_count++; lr_count++;