summaryrefslogtreecommitdiffstats
path: root/mdoc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mdoc.c b/mdoc.c
index f2ac080d..6876d068 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -442,6 +442,8 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
/* NOTREACHED */
}
+ p->parent->nchild++;
+
if ( ! mdoc_valid_pre(mdoc, p))
return(0);
if ( ! mdoc_action_pre(mdoc, p))
@@ -597,6 +599,8 @@ void
mdoc_node_free(struct mdoc_node *p)
{
+ if (p->parent)
+ p->parent->nchild--;
if (p->string)
free(p->string);
if (p->args)
@@ -614,6 +618,7 @@ mdoc_node_freelist(struct mdoc_node *p)
if (p->next)
mdoc_node_freelist(p->next);
+ assert(0 == p->nchild);
mdoc_node_free(p);
}