Skip to content

Commit 4cb4200

Browse files
authored
Merge pull request #360 from lplewa/coverity_log
fix coverity issue in logger tests.
2 parents 566a550 + eb42ffb commit 4cb4200

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/utils/utils_log.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,13 @@ void helper_checkConfig(util_log_config_t *expected, util_log_config_t *is) {
7878
TEST_F(test, parseEnv_errors) {
7979
expected_message = "";
8080
loggerConfig = {0, 0, LOG_ERROR, LOG_ERROR, NULL};
81+
8182
expect_fput_count = 0;
8283
expected_stream = stderr;
8384
util_log_config_t b = loggerConfig;
8485
helper_log_init(NULL);
8586
helper_checkConfig(&b, &loggerConfig);
87+
8688
expect_fput_count = 1;
8789
helper_log_init("");
8890
helper_checkConfig(&b, &loggerConfig);
@@ -92,9 +94,10 @@ TEST_F(test, parseEnv_errors) {
9294
helper_checkConfig(&b, &loggerConfig);
9395
helper_log_init("_level:debug");
9496
helper_checkConfig(&b, &loggerConfig);
95-
expect_fput_count = 1;
9697
expected_message = "[ERROR UMF] Cannot open output file - path too long\n";
97-
helper_log_init(("output:file," + std::string(300, 'x')).c_str());
98+
std::string test_env = "output:file," + std::string(300, 'x');
99+
helper_log_init(test_env.c_str());
100+
env_variable = NULL; // reset env_variable as test_env string is freed.
98101
}
99102

100103
TEST_F(test, parseEnv) {

0 commit comments

Comments
 (0)