summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-04-14 18:54:57 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-04-14 18:54:57 +0200
commit6ba1214f371c56c9c6b0b319d8abccafc3d3f953 (patch)
treec9f2b6ebfd511c7b513b0fe71646c624ef3e75cb
parent265e372805bb30511f86d489ae99a465440f38bf (diff)
memcpy_speed: Properly define ALIGN macro and fix memory leaks
With the previous definition we would use memory *before* our allocated memory area.
-rw-r--r--testsuite/memcpy_speed.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/testsuite/memcpy_speed.c b/testsuite/memcpy_speed.c
index 0715f0e..147cfe2 100644
--- a/testsuite/memcpy_speed.c
+++ b/testsuite/memcpy_speed.c
@@ -11,13 +11,12 @@
#include <orc-test/orcprofile.h>
-#define ALIGN(ptr,n) ((void *)((orc_intptr)(ptr) & (~(orc_intptr)(n-1))))
+#define ALIGN(ptr,n) ((void *)((orc_intptr)(ptr + n) & (~(orc_intptr)(n-1))))
int hot_src = TRUE;
int hot_dest = TRUE;
int flush_cache = FALSE;
-
void
touch (unsigned char *ptr, int n)
{
@@ -174,6 +173,10 @@ main(int argc, char *argv[])
fflush (stdout);
}
+ orc_program_free (p);
+ free (s);
+ free (d);
+
return 0;
}