fix: coverity warnings (#4687)

* fix: minor tr_error leak warning in tests

* fix: socket leak in tr_globalIPv6()
This commit is contained in:
Charles Kerr 2023-01-29 16:49:59 -06:00 committed by GitHub
parent 724a0f48f0
commit 0e5f7f86d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -447,6 +447,7 @@ namespace global_ipv6_helpers
{
if (auto const addrport = tr_address::from_sockaddr(reinterpret_cast<sockaddr*>(&src_ss)); addrport)
{
evutil_closesocket(sock);
errno = save;
return addrport->first;
}

View File

@ -225,7 +225,7 @@ TEST_F(FileTest, getInfo)
// Can't get info of non-existent file/directory
tr_error* err = nullptr;
auto info = tr_sys_path_get_info(path1, 0, &err);
ASSERT_FALSE(info.has_value());
EXPECT_FALSE(info.has_value());
EXPECT_NE(nullptr, err);
tr_error_clear(&err);