From bbc9a5ffe9d85d881d902b550fbd9a397ed42ad5 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Fri, 11 Jul 2008 15:11:39 +0200 Subject: [PATCH] Don't copy memory to itself (valgrind complains). Rev: src/modules/Image/layer_channel.h:1.10 --- src/modules/Image/layer_channel.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/Image/layer_channel.h b/src/modules/Image/layer_channel.h index 75f6a00891..4c76ad86de 100644 --- a/src/modules/Image/layer_channel.h +++ b/src/modules/Image/layer_channel.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: layer_channel.h,v 1.9 2008/01/15 21:51:07 grubba Exp $ +|| $Id: layer_channel.h,v 1.10 2008/07/11 13:11:39 mast Exp $ */ /* template for operator layer row function */ @@ -11,12 +11,14 @@ static void LM_FUNC(rgb_group *s,rgb_group *l,rgb_group *d, rgb_group *sa,rgb_group *la,rgb_group *da, int len,double alpha) { - MEMCPY(da,sa,sizeof(rgb_group)*len); /* always copy alpha channel */ + if (da != sa) + MEMCPY(da,sa,sizeof(rgb_group)*len); /* always copy alpha channel */ #define da da da /* protect */ if (alpha==0.0) { #ifdef LAYER_DUAL - MEMCPY(d,s,sizeof(rgb_group)*len); + if (d != s) + MEMCPY(d,s,sizeof(rgb_group)*len); #endif return; } -- GitLab