reflowCursorInternal double-frees history, leaks memory, and corrupts ring buffer indexreflowCursorInternal double-frees history, leaks memory, and corrupts ring buffer indexFile: src/grid.zig:820–895
Severity: CRITICAL
Status: ✅ FIXED
for (old_history.items) |*l| l.deinit(allocator); frees all history slots, including evicted elements before old_history_start.rewrap or allocator.dupe fails, errdefer cleans up new_lines but leaks old_lines and old_history.self.history_start is left un-reset after setting self.history = new_history.Impact: SIGSEGV double-free crashes during window resize, memory leaks under OOM, and out-of-bounds indexing.
Fix: Save old_history_start. Deinitialize old_history.items[old_history_start..]. Add errdefer restoring old_lines, old_history, and old_history_start. Set self.history_start = 0.