[Swfdec] libswfdec/swfdec_image.c libswfdec/swfdec_image_decoder.c

Pekka Lampila medar at kemper.freedesktop.org
Wed Dec 19 05:53:27 PST 2007


 libswfdec/swfdec_image.c         |    4 ----
 libswfdec/swfdec_image_decoder.c |    2 ++
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 760372154c6a58777b2d593fd3555cf5a8c08128
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Wed Dec 19 15:45:34 2007 +0200

    Fix memory leaks in image code

diff --git a/libswfdec/swfdec_image.c b/libswfdec/swfdec_image.c
index f3d27fc..54e84ca 100644
--- a/libswfdec/swfdec_image.c
+++ b/libswfdec/swfdec_image.c
@@ -190,7 +190,6 @@ swfdec_image_jpeg_load (SwfdecImage *image)
   image->surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_RGB24,
       image->width, image->height, image->width * 4);
   cairo_surface_set_user_data (image->surface, &key, data, g_free);
-  cairo_surface_reference (image->surface);
 
   SWFDEC_LOG ("  width = %d", image->width);
   SWFDEC_LOG ("  height = %d", image->height);
@@ -232,7 +231,6 @@ swfdec_image_jpeg2_load (SwfdecImage *image)
   image->surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_RGB24,
       image->width, image->height, image->width * 4);
   cairo_surface_set_user_data (image->surface, &key, data, g_free);
-  cairo_surface_reference (image->surface);
 
   SWFDEC_LOG ("  width = %d", image->width);
   SWFDEC_LOG ("  height = %d", image->height);
@@ -298,7 +296,6 @@ swfdec_image_jpeg3_load (SwfdecImage *image)
   image->surface = cairo_image_surface_create_for_data (data,
       CAIRO_FORMAT_ARGB32, image->width, image->height, image->width * 4);
   cairo_surface_set_user_data (image->surface, &key, data, g_free);
-  cairo_surface_reference (image->surface);
 }
 
 static void
@@ -483,7 +480,6 @@ out:
       have_alpha ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24, 
       image->width, image->height, image->width * 4);
   cairo_surface_set_user_data (image->surface, &key, data, g_free);
-  cairo_surface_reference (image->surface);
 }
 
 int
diff --git a/libswfdec/swfdec_image_decoder.c b/libswfdec/swfdec_image_decoder.c
index 522859b..17edf90 100644
--- a/libswfdec/swfdec_image_decoder.c
+++ b/libswfdec/swfdec_image_decoder.c
@@ -74,6 +74,8 @@ swfdec_image_get_size (SwfdecImage *image, guint *w, guint *h)
   if (h)
     *h = cairo_image_surface_get_width (surface);
 
+  cairo_surface_destroy (surface);
+
   return TRUE;
 }
 


More information about the Swfdec mailing list