memcpy_speed: Properly define ALIGN macro and fix memory leaks
authorSebastian Dröge <sebastian@centricular.com>
Mon, 14 Apr 2014 16:54:57 +0000 (18:54 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 14 Apr 2014 16:54:57 +0000 (18:54 +0200)
With the previous definition we would use memory *before* our
allocated memory area.

testsuite/memcpy_speed.c

index 0715f0e..147cfe2 100644 (file)
 #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;
 }