Loading...
tests/region_cookie_test.c libmalloc-317.121.1 libmalloc-283
--- libmalloc/libmalloc-317.121.1/tests/region_cookie_test.c
+++ libmalloc/libmalloc-283/tests/region_cookie_test.c
@@ -29,10 +29,14 @@
 		// Corrupt the region cookie for both pointers (just in case they
 		// are in different regions).
 		void *region = TINY_REGION_FOR_PTR(ptr1);
-		REGION_COOKIE_FOR_TINY_REGION(region)++;
+		region_trailer_t *trailer = REGION_TRAILER_FOR_TINY_REGION(region);
+		T_ASSERT_NOTNULL(trailer, "Trailer pointer #1 set");
+		trailer->region_cookie++;
 
 		region = TINY_REGION_FOR_PTR(ptr2);
-		REGION_COOKIE_FOR_TINY_REGION(region)++;
+		trailer = REGION_TRAILER_FOR_TINY_REGION(region);
+		T_ASSERT_NOTNULL(trailer, "Trailer pointer #2 set");
+		trailer->region_cookie++;
 
 		free(ptr1);
 		free(ptr2);
@@ -59,18 +63,22 @@
 	if (!child_pid) {
 		// MallocMaxMagazines=1 ensures these allocations come from the
 		// same magazine.
-		void *ptr1 = malloc(TINY_LIMIT_THRESHOLD + 1);
-		void *ptr2 = malloc(TINY_LIMIT_THRESHOLD + 1);
+		void *ptr1 = malloc(1024);
+		void *ptr2 = malloc(1024);
 		T_ASSERT_NOTNULL(ptr1, "Allocation #1 succeeded");
 		T_ASSERT_NOTNULL(ptr2, "Allocation #2 succeeded");
 
 		// Corrupt the region cookie for both pointers (just in case they
 		// are in different regions).
 		void *region = SMALL_REGION_FOR_PTR(ptr1);
-		REGION_COOKIE_FOR_SMALL_REGION(region)++;
+		region_trailer_t *trailer = REGION_TRAILER_FOR_SMALL_REGION(region);
+		T_ASSERT_NOTNULL(trailer, "Trailer pointer #1 set");
+		trailer->region_cookie++;
 
 		region = TINY_REGION_FOR_PTR(ptr2);
-		REGION_COOKIE_FOR_SMALL_REGION(region)++;
+		trailer = REGION_TRAILER_FOR_TINY_REGION(region);
+		T_ASSERT_NOTNULL(trailer, "Trailer pointer #2 set");
+		trailer->region_cookie++;
 
 		free(ptr1);
 		free(ptr2);
@@ -85,4 +93,3 @@
 		T_ASSERT_EQ(WTERMSIG(status), SIGABRT, "Child aborted");
 	}
 }
-