pixman: Branch 'master'

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Fri Jun 15 22:25:37 PDT 2007


 pixman/pixman-image.c   |    8 +++++++-
 pixman/pixman-private.h |    1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
diff-tree e365aaf7f34d9257fc53e8f180a84fa243edcb2c (from 451a0510324491e82269d8e0d997ee4707ba8df8)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sat Jun 16 01:15:05 2007 -0400

    Plug leak in the bits=NULL case for pixman_image_create_bits()

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index c08e8fc..5420416 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -135,6 +135,9 @@ pixman_image_unref (pixman_image_t *imag
 #if 0
 	memset (image, 0xaa, sizeof (pixman_image_t));
 #endif
+
+	if (image->type == BITS && image->bits.free_me)
+	    free (image->bits.free_me);
 	
 	free (image);
     }
@@ -304,6 +307,7 @@ pixman_image_create_bits (pixman_format_
 			  int			rowstride_bytes)
 {
     pixman_image_t *image;
+    uint32_t *free_me = NULL;
 
     /* must be a whole number of uint32_t's 
      */
@@ -312,7 +316,7 @@ pixman_image_create_bits (pixman_format_
 
     if (!bits)
     {
-	bits = create_bits (format, width, height, &rowstride_bytes);
+	free_me = bits = create_bits (format, width, height, &rowstride_bytes);
 	if (!bits)
 	    return NULL;
     }
@@ -327,6 +331,8 @@ pixman_image_create_bits (pixman_format_
     image->bits.width = width;
     image->bits.height = height;
     image->bits.bits = bits;
+    image->bits.free_me = free_me;
+    
     image->bits.rowstride = rowstride_bytes / sizeof (uint32_t); /* we store it in number
 								  * of uint32_t's
 								  */
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index c0e98c4..c0f25b9 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -239,6 +239,7 @@ struct bits_image
     int				width;
     int				height;
     uint32_t *			bits;
+    uint32_t *			free_me;
     int				rowstride; /* in number of uint32_t's */
 };
 


More information about the xorg-commit mailing list