Pty.spawn when fork() FailsPty.spawn when fork() FailsFile: src/server/pty.zig:117–139
Severity: MEDIUM
Status: ✅ FIXED — added single errdefer block to free szn_env_z, szn_pane_z, and cwd_z on any allocation failure before fork; also added defer block for success-path cleanup (tests don’t exec so parent must still free). Unit test added.
Pty.spawn allocates argv_z and duplicates argument strings. If fork() fails, error.ForkFailed is returned immediately, bypassing cleanup.
Impact: Memory leak on process fork failure under system resource exhaustion.