summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2020-03-13 16:14:15 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2020-03-13 16:14:15 +0000
commit8f2901bf98b094bf85cd531f244aebc098cc14cc (patch)
tree9e2dea7dc9a7b55296531a90b77dadeed2be6402 /usr.bin
parent84c9b476b6b3dd60ebd1519d45911017802c4276 (diff)
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.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/read.c4
-rw-r--r--usr.bin/mandoc/tag.c5
2 files changed, 7 insertions, 2 deletions
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 <schwarze@openbsd.org>
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -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 <schwarze@openbsd.org>
*
@@ -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;
}
/*