Skip to content

Commit

Permalink
Fix leak in scheduler test
Browse files Browse the repository at this point in the history
  • Loading branch information
leemaguire committed Jun 12, 2024
1 parent c82957d commit 9602d2b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/db/run_loop_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ inline void run_until(uv_loop_t *loop, std::function<bool()> predicate) {
uv_idle_stop(observer.idle);
}

TEST_CASE("run loops", "[run loops]") {
TEST_CASE("user defined uv_loop", "[scheduler]") {
realm_path path;

SECTION("threads detached", "[run loops]") {
Expand Down Expand Up @@ -78,7 +78,11 @@ TEST_CASE("run loops", "[run loops]") {
managed_obj.str_col = "456";
});

uv_run(loop, UV_RUN_DEFAULT);
run_until(loop, [&]() {
return signal1;
});
uv_loop_close(loop);
free(loop);
}).detach();
}

Expand Down Expand Up @@ -118,7 +122,11 @@ TEST_CASE("run loops", "[run loops]") {
});
}

uv_run(loop, UV_RUN_DEFAULT);
run_until(loop, [&]() {
return signal2;
});
uv_loop_close(loop);
free(loop);
}).detach();
}

Expand Down Expand Up @@ -157,6 +165,8 @@ TEST_CASE("run loops", "[run loops]") {
});

t1.unregister();
uv_loop_close(loop);
free(loop);
}
}

Expand Down

0 comments on commit 9602d2b

Please sign in to comment.