Skip to content

Commit dd92d76

Browse files
Trinity Agentclaude
andcommitted
fix(cloud-tools): add defer free for stdout allocation (#173)
Add defer std.heap.page_allocator.free(stdout) after readToEndAlloc to fix memory leak in runTriCloud() function that occurred on every MCP tool call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c16ed8f commit dd92d76

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tools/mcp/trinity_mcp/cloud_tools.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ fn runTriCloud(buf: *[MAX_OUTPUT]u8, args: []const []const u8) []const u8 {
7070
const stdout = child.stdout.?.readToEndAlloc(std.heap.page_allocator, MAX_OUTPUT) catch {
7171
return copyToBuf(buf, "Error: Failed to read output");
7272
};
73+
defer std.heap.page_allocator.free(stdout);
7374

7475
_ = child.wait() catch {};
7576

0 commit comments

Comments
 (0)