[wpiutil] Fix uv::Buffer memory leaks caught by asan (#3555)

This commit is contained in:
Tyler Veness
2021-09-09 23:14:10 -07:00
committed by GitHub
parent 2dd5701ac0
commit 828f073ebd
2 changed files with 19 additions and 0 deletions

View File

@@ -12,12 +12,14 @@ TEST(UvSimpleBufferPool, ConstructDefault) {
SimpleBufferPool<> pool;
auto buf1 = pool.Allocate();
ASSERT_EQ(buf1.len, 4096u); // NOLINT
pool.Release({&buf1, 1});
}
TEST(UvSimpleBufferPool, ConstructSize) {
SimpleBufferPool<4> pool{8192};
auto buf1 = pool.Allocate();
ASSERT_EQ(buf1.len, 8192u); // NOLINT
pool.Release({&buf1, 1});
}
TEST(UvSimpleBufferPool, ReleaseReuse) {
@@ -31,6 +33,7 @@ TEST(UvSimpleBufferPool, ReleaseReuse) {
auto buf2 = pool.Allocate();
ASSERT_EQ(buf1copy.base, buf2.base);
ASSERT_EQ(buf2.len, origSize);
pool.Release({&buf2, 1});
}
TEST(UvSimpleBufferPool, ClearRemaining) {