aboutsummaryrefslogtreecommitdiff
path: root/src/wrap.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-03-15 09:01:31 +0100
committerThomas White <taw@bitwiz.org.uk>2013-03-15 09:01:31 +0100
commit4afcee79df1a95f399b6633123ca2e381c79b753 (patch)
tree4d8efc3b81b0d53e67d8d198fcaa5435b3bbaadf /src/wrap.c
parentcf9e1b11c41df6af9b29cb57316fb7c1802f630b (diff)
Fix memory leak
Diffstat (limited to 'src/wrap.c')
-rw-r--r--src/wrap.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/wrap.c b/src/wrap.c
index 6297e0e..45e1f0e 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -719,6 +719,32 @@ static void knuth_suboptimal_fit(struct wrap_line *boxes, double line_length,
}
+void wrap_line_free(struct wrap_line *l)
+{
+ int i;
+ for ( i=0; i<l->n_boxes; i++ ) {
+
+ switch ( l->boxes[i].type ) {
+
+ case WRAP_BOX_PANGO :
+ pango_glyph_string_free(l->boxes[i].glyphs);
+ free(l->boxes[i].text);
+ break;
+
+ case WRAP_BOX_IMAGE :
+ break;
+
+ case WRAP_BOX_NOTHING :
+ break;
+
+ }
+
+ }
+
+ free(l->boxes);
+}
+
+
/* Wrap the StoryCode inside "fr->sc" so that it fits within width "fr->w",
* and generate fr->lines */
int wrap_contents(struct frame *fr, PangoContext *pc)
@@ -735,6 +761,8 @@ int wrap_contents(struct frame *fr, PangoContext *pc)
}
knuth_suboptimal_fit(boxes, wrap_w, fr);
+ free(boxes->boxes);
+ free(boxes);
for ( i=0; i<fr->n_lines; i++ ) {
distribute_spaces(&fr->lines[i], wrap_w);