std.fs.wasi.preopensAlloc
requires an arena, but it claims to want a gpa
#22911
Labels
bug
Observed behavior contradicts documented or intended behavior
os-wasi
standard library
This issue involves writing Zig code for the standard library.
Zig Version
0.14.0-dev.3224+5ab511307
Steps to Reproduce and Observed Behavior
std.fs.wasi.preopensAlloc
returns anames
slice that is a mixture of string literals and heap-allocated strings:zig/lib/std/fs/wasi.zig
Lines 26 to 54 in ddff1fa
This means that there is no safe way to fully free the returned value (since freeing the string literals is illegal behavior), so an arena must be used in order to avoid leaking the heap-allocated slices. However, the
Allocator
parameter is erroneously namedgpa
.Note: All existing usage sites of this function do use an arena when calling this function.
Expected Behavior
Should be updated to work with a gpa or documented to require an arena.
The text was updated successfully, but these errors were encountered: