[cairo] valgrind complaint

Benjamin Otte in7y118 at public.uni-hamburg.de
Tue Jan 30 06:08:52 PST 2007


Hi,

I've just had valgrind complain to me about "Source and destination
overlap in memcpy" (on PPC btw). I'm not sure if this is a bug in cairo
or if it's gcc's fault. I'll attach a patch for you.

Benjamin


diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 2bff0da..5556aee 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1024,7 +1024,8 @@ _cairo_surface_clone_similar (cairo_surf

     status = surface->backend->clone_similar (surface, src, src_x, src_y,
                                              width, height, clone_out);
-    if (status == CAIRO_STATUS_SUCCESS)
+    if (status == CAIRO_STATUS_SUCCESS &&
+       *clone_out != src)
         (*clone_out)->device_transform = src->device_transform;

     if (status != CAIRO_INT_STATUS_UNSUPPORTED)
@@ -1036,7 +1037,8 @@ _cairo_surface_clone_similar (cairo_surf

     status = surface->backend->clone_similar (surface, &image->base,
src_x,
                                              src_y, width, height,
clone_out);
-    if (status == CAIRO_STATUS_SUCCESS)
+    if (status == CAIRO_STATUS_SUCCESS &&
+       *clone_out != src)
         (*clone_out)->device_transform = src->device_transform;

     /* If the above failed point, we could implement a full fallback




More information about the cairo mailing list