diff options
author | wl <wl> | 2009-04-10 18:13:29 +0000 |
---|---|---|
committer | wl <wl> | 2009-04-10 18:13:29 +0000 |
commit | f68481cd98e1d8451dd16d6d1b1b3513110a5559 (patch) | |
tree | 49c5bbf5565ac3b6119b4afb1a380bf0e8717915 /src/roff/troff | |
parent | 3cfd0f2fc12bdff5fd0b587fa98a655805eff75b (diff) | |
download | groff-f68481cd98e1d8451dd16d6d1b1b3513110a5559.tar.gz |
Fix a memory leak in troff for -Thtml.
Reported by Urs Eggli <Urs.Eggli@zuerich.ch>.
* src/roff/troff/node.h (node::~node): Move to...
* src/roff/troff/node.cpp: Here. Free `state' and `push_state'.
Diffstat (limited to 'src/roff/troff')
-rw-r--r-- | src/roff/troff/node.cpp | 11 | ||||
-rw-r--r-- | src/roff/troff/node.h | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index afe49985..58cf59a8 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -1811,6 +1811,14 @@ void suppress_output_file::really_transparent_char(unsigned char) { } +inline node::~node() +{ + if (state != 0) + delete state; + if (push_state != 0) + delete push_state; +} + /* glyphs, ligatures, kerns, discretionary breaks */ class charinfo_node : public node { @@ -4643,7 +4651,7 @@ void hline_node::tprint(troff_output_file *out) } else { hunits rem = x - w*i; - if (rem > H0) + if (rem > H0) { if (n->overlaps_horizontally()) { if (out->is_on()) n->tprint(out); @@ -4651,6 +4659,7 @@ void hline_node::tprint(troff_output_file *out) } else out->right(rem); + } while (--i >= 0) if (out->is_on()) n->tprint(out); diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index a598ae52..9850be21 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -132,10 +132,6 @@ inline node::node(node *n, statem *s, int divlevel) state = 0; } -inline node::~node() -{ -} - // 0 means it doesn't, 1 means it does, 2 means it's transparent int node_list_ends_sentence(node *); |