szn

Bug 460 — Dead errdefers in paneClipboardCallback (void function)

460. errdefer in a void function is dead code

Severity: LOW Status: ✅ FIXED Files: src/server/server.zig


Root Cause Analysis

In src/server/server.zig:2360,2370:

const decoded = self.allocator.alloc(u8, decoded_len) catch return;
errdefer self.allocator.free(decoded); // never runs: fn returns void
...
errdefer self.allocator.free(name); // never runs

Each catch currently frees explicitly, so no live leak — but the dead guards invite a future try that looks covered and leaks.

Proposed Fix

Delete both errdefers or change the function to return !void and use try. Prefer explicit-free style with a comment, matching the surrounding handler.