Skip to content

Commit 960f8d2

Browse files
committed
fix CP78 qualification test buffer ownership
1 parent 4727371 commit 960f8d2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎tests/test_cli.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10479,18 +10479,21 @@ TEST(cli_cp78_explicit_claude_hooks_preserve_mcp_hook_assets) {
1047910479
"\"command\":\"~/.claude/hooks/cbm-code-discovery-gate\"}]}]}}\n");
1048010480

1048110481
int rc = cbm_cmd_install_hooks(0, NULL);
10482-
const char *after_script = read_test_file(mcp_gate_path);
10483-
const char *after_settings = read_test_file(settings_path);
10482+
char *after_script = read_test_file_alloc(mcp_gate_path);
10483+
char *after_settings = read_test_file_alloc(settings_path);
1048410484

1048510485
char cli_gate_path[640];
1048610486
snprintf(cli_gate_path, sizeof(cli_gate_path), "%s/codebase-memory-cli-discovery-gate",
1048710487
hooks_dir);
10488-
const char *cli_gate = read_test_file(cli_gate_path);
10488+
char *cli_gate = read_test_file_alloc(cli_gate_path);
1048910489

1049010490
bool ok = rc == 0 && after_script && strcmp(after_script, mcp_gate) == 0 && after_settings &&
1049110491
strstr(after_settings, mcp_command) &&
1049210492
strstr(after_settings, "codebase-memory-cli-discovery-gate") && cli_gate;
1049310493

10494+
free(after_script);
10495+
free(after_settings);
10496+
free(cli_gate);
1049410497
cli_activation_restore_env(old_home, old_cache);
1049510498
test_rmdir_r(tmpdir);
1049610499
ASSERT_TRUE(ok);

0 commit comments

Comments
 (0)