[cairo-commit] src/cairo-ps-surface.c

Carl Worth cworth at kemper.freedesktop.org
Fri Apr 28 07:08:54 PDT 2006


 src/cairo-ps-surface.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletion(-)

New commits:
diff-tree 516ac16de1ac0cab8e2972e2ac1443fd58c39746 (from 9729fe60246c7d98ddc1f690b924cd10daabf096)
Author: Henning Noren <henning.noren.402 at student.lu.se>
Date:   Fri Apr 28 07:04:56 2006 -0700

    Fix PS Surface Memleak
    
    Fixes leak of 16 bytes when calling _cairo_ps_surface_finish by never freeing
    the closure allocated in _word_wrap_stream_create.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index f84a57a..31498a8 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -762,6 +762,19 @@ _word_wrap_stream_write (void			*closure
     return _cairo_output_stream_get_status (stream->output);
 }
 
+static cairo_status_t
+_word_wrap_stream_close (void *closure)
+{
+    cairo_status_t status;
+    word_wrap_stream_t *stream = closure;
+
+    status = _cairo_output_stream_get_status (stream->output);
+
+    free (stream);
+
+    return status;
+}
+
 static cairo_output_stream_t *
 _word_wrap_stream_create (cairo_output_stream_t *output, int max_column)
 {
@@ -777,7 +790,7 @@ _word_wrap_stream_create (cairo_output_s
     stream->last_write_was_space = FALSE;
 
     return _cairo_output_stream_create (_word_wrap_stream_write,
-					NULL, stream);
+					_word_wrap_stream_close, stream);
 }
 
 static cairo_surface_t *


More information about the cairo-commit mailing list