summaryrefslogtreecommitdiff
path: root/src/roff/troff
diff options
context:
space:
mode:
authorwl <wl>2009-04-10 18:13:29 +0000
committerwl <wl>2009-04-10 18:13:29 +0000
commitf68481cd98e1d8451dd16d6d1b1b3513110a5559 (patch)
tree49c5bbf5565ac3b6119b4afb1a380bf0e8717915 /src/roff/troff
parent3cfd0f2fc12bdff5fd0b587fa98a655805eff75b (diff)
downloadgroff-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.cpp11
-rw-r--r--src/roff/troff/node.h4
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 *);