catchorg / catchorg/Catch2

Memory leak when using exit()

Open
#2,864 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

**Describe the bug**
I noticed valgrind reports a leak when using `exit(0)` in a test case.

**Expected behavior**
I would expect it not to leak.

**Reproduction steps**
```
TEST_CASE("fork") {
pid_t pid = fork();
REQUIRE(pid != -1);
if (pid == 0) {
exit(0);
} else {
int status;
waitpid(pid, &status, 0);
}
CHECK(true);
}
// valgrind --leak-check=full ./binary
```

**Platform information:**

- OS: linux
- Compiler+version: g++ (GCC) 13.2.1 20230801
- Catch version: v3.5.3

**Additional context**
valgrind version: 3.22

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.