diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2021-10-04 18:56:31 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2021-10-04 18:56:31 +0000 |
commit | 3d2bee60386823d65fd28f111425ea3de7585bb7 (patch) | |
tree | e1cd71fdca51a50f88b8fec70f0b9a7763574a39 /term.c | |
parent | d9e36737be633b363b9bcd7279d111cf27e49f8a (diff) | |
download | mandoc-3d2bee60386823d65fd28f111425ea3de7585bb7.tar.gz |
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 'term.c')
-rw-r--r-- | term.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,7 +1,7 @@ /* $Id$ */ /* + * 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 @@ -58,6 +58,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); |