-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't workingp2-mediumDegraded experience, workaround existsDegraded experience, workaround existsupstreamBug exists in upstream ghosttyBug exists in upstream ghosttyzig-forkRequires Ghostty fork changesRequires Ghostty fork changes
Description
Summary
ghostty_surface_inherited_config (embedded.zig:1044-1061) allocates a dupeZ of the working directory via the app allocator, then returns the Options struct by value. The C header declares ghostty_surface_config_s containing const char* working_directory.
The caller receives a raw pointer to heap memory with:
- No documented ownership
- No free function
- No indication that the caller must free it
This is a memory leak if the caller doesn't free it, or a use-after-free if the caller incorrectly frees it with the wrong allocator.
Fix
Either:
- Document the ownership and provide a
ghostty_surface_config_freefunction. - Use a static/arena-allocated string with clear lifetime semantics.
Severity
MEDIUM — Memory leak per call. Not a crash but accumulates.
Source
Identified during code review of daiimus/ghostty:ios-external-backend.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingp2-mediumDegraded experience, workaround existsDegraded experience, workaround existsupstreamBug exists in upstream ghosttyBug exists in upstream ghosttyzig-forkRequires Ghostty fork changesRequires Ghostty fork changes