]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/hwasan/TestCases/malloc-test.c
Vendor import of compiler-rt trunk r351319 (just before the release_80
[FreeBSD/FreeBSD.git] / test / hwasan / TestCases / malloc-test.c
1 // Test basic malloc functionality.
2 // RUN: %clang_hwasan %s -o %t
3 // RUN: %run %t
4
5 #include <stdlib.h>
6 #include <assert.h>
7 #include <sanitizer/hwasan_interface.h>
8 #include <sanitizer/allocator_interface.h>
9
10 int main() {
11   __hwasan_enable_allocator_tagging();
12   char *a1 = (char*)malloc(0);
13   assert(a1 != 0);
14   assert(__sanitizer_get_allocated_size(a1) == 0);
15   free(a1);
16 }