From 8f2901bf98b094bf85cd531f244aebc098cc14cc Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 13 Mar 2020 16:14:15 +0000 Subject: Properly reset the validation part of the tagging module between files. This fixes a crash in makewhatis(8) encountered by naddy@. I'm very sorry for the disruption of the build. --- usr.bin/mandoc/read.c | 4 +++- usr.bin/mandoc/tag.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/mandoc/read.c b/usr.bin/mandoc/read.c index a32274c5d0a..2fcabf8bb46 100644 --- a/usr.bin/mandoc/read.c +++ b/usr.bin/mandoc/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.186 2020/03/13 00:31:05 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.187 2020/03/13 16:14:14 schwarze Exp $ */ /* * Copyright (c) 2010-2019 Ingo Schwarze * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons @@ -676,11 +676,13 @@ mparse_alloc(int options, enum mandoc_os os_e, const char *os_s) void mparse_reset(struct mparse *curp) { + tag_free(); roff_reset(curp->roff); roff_man_reset(curp->man); free_buf_list(curp->secondary); curp->secondary = NULL; curp->gzip = 0; + tag_alloc(); } void diff --git a/usr.bin/mandoc/tag.c b/usr.bin/mandoc/tag.c index 8bdf9943597..7d4790d873a 100644 --- a/usr.bin/mandoc/tag.c +++ b/usr.bin/mandoc/tag.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tag.c,v 1.28 2020/03/13 00:31:05 schwarze Exp $ */ +/* $OpenBSD: tag.c,v 1.29 2020/03/13 16:14:14 schwarze Exp $ */ /* * Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze * @@ -57,6 +57,8 @@ tag_free(void) struct tag_entry *entry; unsigned int slot; + if (tag_data.info.free == NULL) + return; entry = ohash_first(&tag_data, &slot); while (entry != NULL) { free(entry->nodes); @@ -64,6 +66,7 @@ tag_free(void) entry = ohash_next(&tag_data, &slot); } ohash_delete(&tag_data); + tag_data.info.free = NULL; } /* -- cgit v1.2.3