[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / short-granule-disabled.cpp
blob2f35b10bd8dad8074e3be58945cf15fcb8205888
1 // RUN: %clangxx_hwasan %s -o %t && %run %t 2>&1
3 #include <sanitizer/hwasan_interface.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
8 // Regression test for https://reviews.llvm.org/D107938#2961070, where, on
9 // reusing an allocation, we forgot to reset the short granule tag if the
10 // allocator was disabled. This lead to a false positive magic-string mismatch.
12 int main() {
13 void *p = malloc(16);
14 memset(p, 0xff, 16);
15 free(p);
17 // Relies on the LRU cache immediately recycling the allocation above.
18 p = malloc(8);
19 free(p); // Regression was here, in the magic-string check in the runtime.
20 return 0;