=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/eqn.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- src/usr.bin/mandoc/eqn.c 2018/12/12 21:54:30 1.42 +++ src/usr.bin/mandoc/eqn.c 2018/12/13 03:40:09 1.43 @@ -1,4 +1,4 @@ -/* $OpenBSD: eqn.c,v 1.42 2018/12/12 21:54:30 schwarze Exp $ */ +/* $OpenBSD: eqn.c,v 1.43 2018/12/13 03:40:09 schwarze Exp $ */ /* * Copyright (c) 2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015, 2017 Ingo Schwarze @@ -28,9 +28,8 @@ #include "mandoc_aux.h" #include "mandoc.h" #include "roff.h" -#include "tbl.h" #include "libmandoc.h" -#include "libroff.h" +#include "eqn_parse.h" #define EQN_NEST_MAX 128 /* maximum nesting of defines */ #define STRNEQ(p1, sz1, p2, sz2) \ @@ -283,6 +282,13 @@ MODE_TOK }; +struct eqn_def { + char *key; + size_t keysz; + char *val; + size_t valsz; +}; + static struct eqn_box *eqn_box_alloc(struct eqn_node *, struct eqn_box *); static struct eqn_box *eqn_box_makebinary(struct eqn_node *, struct eqn_box *); @@ -467,6 +473,8 @@ void eqn_box_free(struct eqn_box *bp) { + if (bp == NULL) + return; if (bp->first) eqn_box_free(bp->first); @@ -1090,6 +1098,9 @@ eqn_free(struct eqn_node *p) { int i; + + if (p == NULL) + return; for (i = 0; i < (int)p->defsz; i++) { free(p->defs[i].key);