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

Carl Worth cworth at kemper.freedesktop.org
Wed Dec 19 11:11:30 PST 2007


 src/cairo-glitz-surface.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit c2adfb4052f72e1e6e6d283de3428b5453dac537
Author: Jim Meyering <jim at meyering.net>
Date:   Sat Dec 15 16:42:25 2007 +0100

    Don't leak memory upon failed realloc.
    
    * cairo-glitz-surface.c (_cairo_glitz_surface_composite_trapezoids):
    
    Signed-off-by: Jim Meyering <meyering at redhat.com>

diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index eb68b43..05e80db 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -1305,9 +1305,10 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t  op,
 	{
 	    if (data_size < size)
 	    {
+		void *p;
 		data_size = size;
-		data = realloc (data, data_size);
-		if (!data)
+		p = realloc (data, data_size);
+		if (!p)
 		{
 		    _cairo_glitz_pattern_release_surface (src_pattern, src,
 							  &attributes);
@@ -1315,6 +1316,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t  op,
 			_cairo_pattern_fini (&tmp_src_pattern.base);
 		    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 		}
+		data = p;
 
 		if (buffer)
 		    glitz_buffer_destroy (buffer);


More information about the cairo-commit mailing list