catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.51k stars 3.04k forks source link

Memory leak when using exit() #2864

Open itacud95 opened 5 months ago

itacud95 commented 5 months ago

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:

Additional context valgrind version: 3.22