diff options
-rw-r--r-- | mdoc_validate.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 6f78f7b2..fc0b6e18 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1950,7 +1950,7 @@ static int post_sh_head(POST_ARGS) { struct mdoc_node *n; - const char *secname; + char *secname; enum mdoc_sec sec; /* @@ -1962,15 +1962,8 @@ post_sh_head(POST_ARGS) secname = NULL; sec = SEC_CUSTOM; - n = mdoc->last; - if (n->child) { - assert(1 == n->nchild); - n = n->child; - assert(NULL != n); - assert(MDOC_TEXT == n->type); - secname = n->string; - sec = a2sec(secname); - } + mdoc_deroff(&secname, mdoc->last); + sec = NULL == secname ? SEC_CUSTOM : a2sec(secname); /* The NAME should be first. */ @@ -2007,8 +2000,10 @@ post_sh_head(POST_ARGS) /* We don't care about custom sections after this. */ - if (SEC_CUSTOM == sec) + if (SEC_CUSTOM == sec) { + free(secname); return(1); + } /* * Check whether our non-custom section is being repeated or is @@ -2052,6 +2047,7 @@ post_sh_head(POST_ARGS) break; } + free(secname); return(1); } |