diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2021-10-04 18:56:25 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2021-10-04 18:56:25 +0000 |
commit | 791d50fd7be74738094a10cf7193740e5950b983 (patch) | |
tree | 015c22447eec502c116e07c63024c2a1956c0668 /usr.bin/mandoc/term.c | |
parent | d8836b11b3811a8d3c173cf7166046874a3fdda2 (diff) |
Provide a cleanup function for the term_tab module, freeing memory
and resetting the internal state to the initial state.
Call this function from the proper place in term_free().
With the way the module is currently used, this does not imply any
functional change, but doing proper cleanup is more robust, makes
it easier during code review to understand what is going on, and
makes it explicit that there is no memory leak.
Diffstat (limited to 'usr.bin/mandoc/term.c')
-rw-r--r-- | usr.bin/mandoc/term.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/mandoc/term.c b/usr.bin/mandoc/term.c index 219c6db7509..2be4eb4aec9 100644 --- a/usr.bin/mandoc/term.c +++ b/usr.bin/mandoc/term.c @@ -1,7 +1,7 @@ -/* $OpenBSD: term.c,v 1.143 2021/08/10 12:36:42 schwarze Exp $ */ +/* $OpenBSD: term.c,v 1.144 2021/10/04 18:56:24 schwarze Exp $ */ /* + * Copyright (c) 2010-2021 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2010-2020 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -56,6 +56,7 @@ term_setcol(struct termp *p, size_t maxtcol) void term_free(struct termp *p) { + term_tab_free(); for (p->tcol = p->tcols; p->tcol < p->tcols + p->maxtcol; p->tcol++) free(p->tcol->buf); free(p->tcols); |