summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/groff/files/groff-1.20.1-Thtml-mem-leak.patch')
-rw-r--r--sys-apps/groff/files/groff-1.20.1-Thtml-mem-leak.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/sys-apps/groff/files/groff-1.20.1-Thtml-mem-leak.patch b/sys-apps/groff/files/groff-1.20.1-Thtml-mem-leak.patch
new file mode 100644
index 000000000000..b95ed426280f
--- /dev/null
+++ b/sys-apps/groff/files/groff-1.20.1-Thtml-mem-leak.patch
@@ -0,0 +1,70 @@
+https://bugs.gentoo.org/294045
+
+From f68481cd98e1d8451dd16d6d1b1b3513110a5559 Mon Sep 17 00:00:00 2001
+From: wl <wl>
+Date: Fri, 10 Apr 2009 18:13:29 +0000
+Subject: [PATCH] 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'.
+---
+ ChangeLog | 8 ++++++++
+ src/roff/troff/node.cpp | 11 ++++++++++-
+ src/roff/troff/node.h | 4 ----
+ 3 files changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp
+index afe4998..58cf59a 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 a598ae5..9850be2 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 *);
+--
+1.7.1.1
+