[MLIR] print/parse resource handle key quoted and escaped (#119746)
[llvm-project.git] / compiler-rt / test / lsan / TestCases / Linux / fork_and_leak.cpp
blob2158c8a26bac2e6be5df63c8c2839e951e8a9fe9
1 // Test that leaks detected after forking without exec().
2 // RUN: %clangxx_lsan %s -o %t && not %run %t 2>&1 | FileCheck %s
4 /// Fails on clang-cmake-aarch64-full (glibc 2.27-3ubuntu1.4).
5 // UNSUPPORTED: target=aarch64{{.*}}
7 #include <assert.h>
8 #include <stdlib.h>
9 #include <sys/wait.h>
10 #include <unistd.h>
12 int main() {
13 pid_t pid = fork();
14 assert(pid >= 0);
15 if (pid > 0) {
16 int status = 0;
17 waitpid(pid, &status, 0);
18 assert(WIFEXITED(status));
19 return WEXITSTATUS(status);
20 } else {
21 for (int i = 0; i < 10; ++i)
22 malloc(1337);
23 // CHECK: LeakSanitizer: detected memory leaks
25 return 0;