Skip to content

Commit

Permalink
[coverity] Fix 1566349 Resource leak
Browse files Browse the repository at this point in the history
Move `ur_loader_config_handle_t` cleanup to the text fixture's
`TearDown()`.
  • Loading branch information
kbenzie committed Jul 18, 2023
1 parent 19fdd60 commit 38141b3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/loader/loader_config/urLoaderConfigCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@

#include "fixtures.hpp"

struct LoaderConfigCreateTest : ::testing::Test {};
struct LoaderConfigCreateTest : ::testing::Test {
void TearDown() override {
if (loaderConfig) {
ASSERT_SUCCESS(urLoaderConfigRelease(loaderConfig));
}
}

TEST_F(LoaderConfigCreateTest, Success) {
ur_loader_config_handle_t loaderConfig = nullptr;
};

TEST_F(LoaderConfigCreateTest, Success) {
ASSERT_SUCCESS(urLoaderConfigCreate(&loaderConfig));
ASSERT_SUCCESS(urLoaderConfigRelease(loaderConfig));
}

TEST_F(LoaderConfigCreateTest, InvalidNullPointerLoaderConfig) {
Expand Down

0 comments on commit 38141b3

Please sign in to comment.