source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Properly reset the validation part of the tagging module between
Date: Fri, 13 Mar 2020 11:17:28 -0500 (EST)	[thread overview]
Message-ID: <11ff0e624ff015f5@mandoc.bsd.lv> (raw)

Log Message:
-----------
Properly reset the validation part of the tagging module between files.
This fixes a crash in makewhatis(8) encountered by naddy@.

Modified Files:
--------------
    mandoc:
        read.c
        tag.c

Revision Data
-------------
Index: read.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/read.c,v
retrieving revision 1.215
retrieving revision 1.216
diff -Lread.c -Lread.c -u -p -r1.215 -r1.216
--- read.c
+++ read.c
@@ -678,11 +678,13 @@ mparse_alloc(int options, enum mandoc_os
 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
Index: tag.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tag.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -Ltag.c -Ltag.c -u -p -r1.28 -r1.29
--- tag.c
+++ tag.c
@@ -59,6 +59,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);
@@ -66,6 +68,7 @@ tag_free(void)
 		entry = ohash_next(&tag_data, &slot);
 	}
 	ohash_delete(&tag_data);
+	tag_data.info.free = NULL;
 }
 
 /*
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2020-03-13 16:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11ff0e624ff015f5@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    --subject='Re: mandoc: Properly reset the validation part of the tagging module between' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).